Author: David Schneider <[email protected]>
Branch: disable_merge_different_int_types
Changeset: r49693:2cba060a3f7a
Date: 2011-11-23 17:04 +0100
http://bitbucket.org/pypy/pypy/changeset/2cba060a3f7a/

Log:    (arigo, bivab): more fixes (not really tested)

diff --git a/pypy/annotation/binaryop.py b/pypy/annotation/binaryop.py
--- a/pypy/annotation/binaryop.py
+++ b/pypy/annotation/binaryop.py
@@ -261,6 +261,9 @@
 
         if t1 is t2:
             knowntype = t1
+        elif (t1 is int and t2 is rarithmetic.r_int) or (
+              t2 is int and t1 is rarithmetic.r_int):
+            knowntype = rarithmetic.r_int
         elif t2 is int:
             if not int2.is_constant():
                raise UnionError, "Merging %s and a non-constant int is not 
allowed" % t1
diff --git a/pypy/rlib/test/test_rarithmetic.py 
b/pypy/rlib/test/test_rarithmetic.py
--- a/pypy/rlib/test/test_rarithmetic.py
+++ b/pypy/rlib/test/test_rarithmetic.py
@@ -126,13 +126,18 @@
             cmp = f(r_uint(arg))
             assert res == cmp
         
-    def binary_test(self, f, rargs = None):
+    def binary_test(self, f, rargs = None, translated=False):
         mask = maxint_mask 
         if not rargs:
             rargs = (1, 3, 55)
+        # when translated merging different int types is not allowed
+        if translated:
+            alltypes = [(r_uint, r_uint)]
+        else:
+            alltypes = [(int, r_uint), (r_uint, int), (r_uint, r_uint)]
         for larg in (0, 1, 2, 3, 1234):
             for rarg in rargs:
-                for types in ((int, r_uint), (r_uint, int), (r_uint, r_uint)):
+                for types in alltypes:
                     res = f(larg, rarg)
                     left, right = types
                     cmp = f(left(larg), right(rarg))
diff --git a/pypy/translator/jvm/test/test_rarithmetic.py 
b/pypy/translator/jvm/test/test_rarithmetic.py
--- a/pypy/translator/jvm/test/test_rarithmetic.py
+++ b/pypy/translator/jvm/test/test_rarithmetic.py
@@ -32,7 +32,7 @@
                     cache[types] = fun
                 return cache[types](x, y)
             return f(x,y)
-        super(BaseAdaptedTest,self).binary_test(new_func, rargs)
+        super(BaseAdaptedTest,self).binary_test(new_func, rargs, 
translated=True)
 
 class Test_r_uint(BaseAdaptedTest, BaseTest_r_uint):
     RTYPE = ra.r_uint    
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to