fix rql simplification: properly update typerels / remove extra uid relations
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 09 Oct 2009 19:18:12 +0200
changeset 473 27e3b01795e5
parent 472 38cc25b76f42
child 474 fb5b388f7436
fix rql simplification: properly update typerels / remove extra uid relations
__init__.py
--- a/__init__.py	Fri Oct 09 15:11:34 2009 +0200
+++ b/__init__.py	Fri Oct 09 19:18:12 2009 +0200
@@ -162,9 +162,16 @@
                             rhs = copy_uid_node(select, rhs, vconsts)
                             select.groupby[select.groupby.index(vref)] = rhs
                             rhs.parent = select
-                    elif rel is uidrel or rel.is_types_restriction():
+                    elif rel is uidrel:
                         # drop this relation
                         rel.parent.remove(rel)
+                    elif rel.is_types_restriction():
+                        stinfo['typerels'].remove(rel)
+                        rel.parent.remove(rel)
+                    elif rel in stinfo['uidrels']:
+                        # XXX check equivalence not necessary else we wouldn't be here right?
+                        stinfo['uidrels'].remove(rel)
+                        rel.parent.remove(rel)
                     else:
                         rhs = copy_uid_node(select, rhs, vconsts)
                         vref.parent.replace(vref, rhs)