[pypy-svn] r27169 - in pypy/dist/pypy: annotation rpython/ootypesystem/test
antocuni at codespeak.net
antocuni at codespeak.net
Sat May 13 15:04:16 CEST 2006
Author: antocuni
Date: Sat May 13 15:04:05 2006
New Revision: 27169
Modified:
pypy/dist/pypy/annotation/builtin.py
pypy/dist/pypy/rpython/ootypesystem/test/test_ooann.py
pypy/dist/pypy/rpython/ootypesystem/test/test_oortype.py
Log:
Made the annotator aware that oostring is a builtin function. This
fixed some failing tests in test_ooann, test_oortype, test_rstr.
Modified: pypy/dist/pypy/annotation/builtin.py
==============================================================================
--- pypy/dist/pypy/annotation/builtin.py (original)
+++ pypy/dist/pypy/annotation/builtin.py Sat May 13 15:04:05 2006
@@ -501,6 +501,10 @@
assert isinstance(i, SomeOOInstance)
return SomeInteger()
+def oostring(obj):
+ assert isinstance(obj, (SomeInteger, SomeChar, SomeString))
+ return SomeString()
+
BUILTIN_ANALYZERS[ootype.instanceof] = instanceof
BUILTIN_ANALYZERS[ootype.new] = new
BUILTIN_ANALYZERS[ootype.null] = null
@@ -508,6 +512,7 @@
BUILTIN_ANALYZERS[ootype.classof] = classof
BUILTIN_ANALYZERS[ootype.subclassof] = subclassof
BUILTIN_ANALYZERS[ootype.ooidentityhash] = ooidentityhash
+BUILTIN_ANALYZERS[ootype.oostring] = oostring
#________________________________
# non-gc objects
Modified: pypy/dist/pypy/rpython/ootypesystem/test/test_ooann.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/test/test_ooann.py (original)
+++ pypy/dist/pypy/rpython/ootypesystem/test/test_ooann.py Sat May 13 15:04:05 2006
@@ -206,3 +206,12 @@
a = RPythonAnnotator()
s = a.build_types(oof, [])
assert s == annmodel.SomeOOInstance(String)
+
+def test_oostring():
+ def oof():
+ return new
+
+ a = RPythonAnnotator()
+ s = a.build_types(oof, [])
+ assert isinstance(s, annmodel.SomeBuiltin)
+
Modified: pypy/dist/pypy/rpython/ootypesystem/test/test_oortype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/test/test_oortype.py (original)
+++ pypy/dist/pypy/rpython/ootypesystem/test/test_oortype.py Sat May 13 15:04:05 2006
@@ -202,3 +202,4 @@
ch = 'a'
res = interpret(oof, [ch], type_system='ootype')
+ assert res._str == 'a'
More information about the Pypy-commit
mailing list