# HG changeset patch
# User Sylvain <syt@logilab.fr>
# Date 1211400132 -7200
#      Wed May 21 22:02:12 2008 +0200
# Node ID 6ee7069ca42c6866c90a888b622d96f3e7226248
# Parent  348a700c52303947e1e142f5435fa9817ce85924
set stinfo['possibletypes'] and update solution dictionnary for variable inserted for new identity relation

diff --git a/stcheck.py b/stcheck.py
--- a/stcheck.py
+++ b/stcheck.py
@@ -367,6 +367,9 @@
                             continue
             # shared references
             newvar.stinfo['constnode'] = var.stinfo['constnode']
+            newvar.stinfo['possibletypes'] = var.stinfo['possibletypes']
+            for sol in newvar.stmt.solutions:
+                sol[newvar.name] = sol[var.name]
             rel = exists.add_relation(var, 'identity', newvar)
             # we have to force visit of the introduced relation
             self.visit_relation(rel, exists)
diff --git a/stmts.py b/stmts.py
--- a/stmts.py
+++ b/stmts.py
@@ -102,7 +102,10 @@
             var.stinfo['possibletypes'] = set()
             for solution in solutions:
                 var.stinfo['possibletypes'].add(solution[var.name])
-
+        # for debugging
+        #for sol in solutions:
+        #    for vname in sol:
+        #        assert vname in self.defined_vars or vname in self.aliases
         
 class Statement(object):
     """base class for statement nodes"""