1. Pypy
  2. Untitled project
  3. pypy

Commits

Alex Gaynor  committed 09e76fd

a failing test for using specialize.memo and specialize.arg together

  • Participants
  • Parent commits 41c799d
  • Branches default

Comments (0)

Files changed (1)

File pypy/annotation/test/test_annrpython.py

View file
  • Ignore whitespace
                 return a_str.strip(' ')
             elif n == 1:
                 return a_str.rstrip(' ')
-            else: 
+            else:
                 return a_str.lstrip(' ')
         s = a.build_types(f, [int, annmodel.SomeString(no_nul=True)])
         assert s.no_nul
         s = a.build_types(f, [int])
         assert s.listdef.listitem.range_step == 0
 
+    def test_specialize_arg_memo(self):
+        @objectmodel.specialize.memo()
+        def g(n):
+            return n
+        @objectmodel.specialize.arg(0)
+        def f(i):
+            return g(i)
+        def main(i):
+            if i == 2:
+                return f(i)
+            elif i == 3:
+                return f(i)
+            else:
+                raise NotImplementedError
+
+        a = self.RPythonAnnotator()
+        s = a.build_types(f, [int])
+        assert isinstance(s, SomeInteger)
+
 
 def g(n):
     return [0,1,2,n]