1. Greg Price
  2. pypy

Commits

Greg Price  committed d17bf3d Draft

Add char to signature types

  • Participants
  • Parent commits 0e521e9
  • Branches signatures

Comments (0)

Files changed (2)

File pypy/annotation/types.py

View file
 def str():
     return model.SomeString()
 
+def char():
+    return model.SomeChar()
+
 def list(element):
     listdef = ListDef(None, element, mutated=True, resized=True)
     return model.SomeList(listdef)

File pypy/rlib/test/test_objectmodel.py

View file
     assert caller.func_name in repr(exc.args)
 
 def test_signature_basic():
-    @signature(types.int(), types.str(), returns=types.int())
+    @signature(types.int(), types.str(), returns=types.char())
     def f(a, b):
-        return a + len(b)
-    assert getsig(f) == [model.SomeInteger(), model.SomeString(), model.SomeInteger()]
+        return b[a]
+    assert getsig(f) == [model.SomeInteger(), model.SomeString(), model.SomeChar()]
 
 def test_signature_arg_errors():
     @signature(types.int(), types.str(), returns=types.int())