[pypy-svn] rev 2626 - in pypy/trunk/src/pypy/annotation: . test
pedronis at codespeak.net
pedronis at codespeak.net
Sat Dec 20 11:22:27 CET 2003
Author: pedronis
Date: Sat Dec 20 11:22:26 2003
New Revision: 2626
Modified:
pypy/trunk/src/pypy/annotation/annset.py
pypy/trunk/src/pypy/annotation/test/test_annset.py
Log:
fixed second level rec merge involving impossiblevalues & in general not
SomeValue values.
Modified: pypy/trunk/src/pypy/annotation/annset.py
==============================================================================
--- pypy/trunk/src/pypy/annotation/annset.py (original)
+++ pypy/trunk/src/pypy/annotation/annset.py Sat Dec 20 11:22:26 2003
@@ -131,6 +131,10 @@
if self.isshared(oldvalue, newvalue):
return oldvalue
+ if not (isinstance(oldvalue, SomeValue) and
+ isinstance(newvalue, SomeValue)):
+ return mostgeneralvalue
+
# build an About set that is the intersection of the two incoming ones
about1 = self._about(oldvalue)
about2 = self._about(newvalue)
@@ -141,13 +145,10 @@
someval2, dep2 = about2.annotations[pred]
if someval1 == someval2:
someval3 = someval1
- elif (isinstance(someval1, SomeValue) and
- isinstance(someval2, SomeValue)):
+ else:
someval3 = self.merge(someval1, someval2)
if someval3 is mostgeneralvalue:
- continue
- else:
- continue # annotation not in common
+ continue # annotation not in common
dep3 = dep1.copy()
dep3.update(dep2)
about3.annotations[pred] = someval3, dep3
Modified: pypy/trunk/src/pypy/annotation/test/test_annset.py
==============================================================================
--- pypy/trunk/src/pypy/annotation/test/test_annset.py (original)
+++ pypy/trunk/src/pypy/annotation/test/test_annset.py Sat Dec 20 11:22:26 2003
@@ -3,7 +3,7 @@
from pypy.tool import test
from pypy.annotation.model import SomeValue, ANN, Predicate
-from pypy.annotation.annset import AnnotationSet, mostgeneralvalue
+from pypy.annotation.annset import AnnotationSet, mostgeneralvalue,impossiblevalue
c1,c2,c3,c4 = SomeValue(), SomeValue(), SomeValue(), SomeValue()
@@ -135,6 +135,19 @@
links=[c3,c])
self.assertSameSet(a1, a2)
+ def test_level2_merge_w_impossible(self):
+ a1 = annset(ANN.type, c1, list,
+ ANN.listitems, c1, impossiblevalue,
+ ANN.type, c2, list,
+ ANN.listitems, c2, c3,
+ ANN.type, c3, int)
+ c = a1.merge(c1,c2)
+ a2 = annset(ANN.type, c , list,
+ ANN.listitems, c, c3,
+ ANN.type, c3, int,
+ links=[c1,c])
+ self.assertSameSet(a1,a2)
+
def test_merge_generalize_both_immutables(self):
a1 = annset(ANN.len, c1, c2,
ANN.immutable, c1,
More information about the Pypy-commit
mailing list