[pypy-svn] r44517 - pypy/dist/pypy/annotation/test

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Jun 25 18:32:43 CEST 2007


Author: cfbolz
Date: Mon Jun 25 18:32:42 2007
New Revision: 44517

Modified:
   pypy/dist/pypy/annotation/test/test_annrpython.py
Log:
a passing test for specialize:ctr_location in the attempt to make sense
of my current problems.


Modified: pypy/dist/pypy/annotation/test/test_annrpython.py
==============================================================================
--- pypy/dist/pypy/annotation/test/test_annrpython.py	(original)
+++ pypy/dist/pypy/annotation/test/test_annrpython.py	Mon Jun 25 18:32:42 2007
@@ -2754,6 +2754,25 @@
         assert isinstance(s.items[2], annmodel.SomeInstance)
         assert s.items[2].flags == {}
 
+    def test_ctr_location(self):
+        from pypy.rlib.jit import hint
+
+        class A:
+            _annspecialcase_ = 'specialize:ctr_location'
+            def __init__(self, x):
+                self.x = x
+
+        def f(n):
+            a = A(2 * n)
+            a.x = n
+            b = A("")
+            b.x = str(n)
+            return len(b.x) + a.x
+        a = self.RPythonAnnotator()
+        s = a.build_types(f, [int])
+        assert isinstance(s, annmodel.SomeInteger)
+
+
 def g(n):
     return [0,1,2,n]
 



More information about the Pypy-commit mailing list