Commits

Alexander Schremmer  committed d33bcb6

(armin, alexander) Fix rtyping and actually using calls on controller instances.

  • Participants
  • Parent commits af212b2

Comments (0)

Files changed (2)

File pypy/rpython/rcontrollerentry.py

     def rtype_is_true(self, hop):
         return self.controller.rtype_is_true(hop)
 
+    def rtype_simple_call(self, hop):
+        return self.controller.rtype_call(hop)
+
 
 class __extend__(pairtype(ControlledInstanceRepr, Repr)):
 

File pypy/rpython/test/test_controllerentry.py

     def setitem(self, obj, key, value):
         value.append(obj + key)
 
+    def call(self, obj, arg):
+        return obj + arg
+
 class Entry(ControllerEntry):
     _about_ = C
     _controller_ = C_Controller
     lst = []
     c = C(a)
     c['foo'] = lst    # side-effect on lst!  well, it's a test
-    return c['bar'], lst[0]
+    call_res = c("baz")
+    return c['bar'], lst[0], call_res
 
 def test_getsetitem_annotate():
     a = RPythonAnnotator()
     s = a.build_types(fun3, [a.bookkeeper.immutablevalue("4")])
-    assert s.const == ("4_bar", "4_foo")
+    assert s.const == ("4_bar", "4_foo", "4_baz")
 
 def test_getsetitem_specialize():
     res = interpret(fun3, ["4"])
     assert ''.join(res.item0.chars) == "4_bar"
     assert ''.join(res.item1.chars) == "4_foo"
+    assert ''.join(res.item2.chars) == "4_baz"