forked from M-Labs/artiq
parent
1845a134e5
commit
2dc8d417ca
|
@ -561,7 +561,11 @@ class StitchingInferencer(Inferencer):
|
|||
# of having the host-to-ARTIQ mapping code in only one place and
|
||||
# also immediately getting proper diagnostics on type errors.
|
||||
attr_value = getattr(object_value, attr_name)
|
||||
if inspect.ismethod(attr_value) and types.is_instance(object_type):
|
||||
if (inspect.ismethod(attr_value) and
|
||||
types.is_instance(object_type) and
|
||||
# Check that the method is indeed defined on the class,
|
||||
# and not just this instance.
|
||||
hasattr(type(attr_value), attr_name)):
|
||||
# In cases like:
|
||||
# class c:
|
||||
# @kernel
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# RUN: %python -m artiq.compiler.testbench.embedding %s
|
||||
|
||||
from artiq.language.core import *
|
||||
from artiq.language.types import *
|
||||
|
||||
class a:
|
||||
def foo(self, x):
|
||||
print(x)
|
||||
|
||||
class b:
|
||||
def __init__(self):
|
||||
self.obj = a()
|
||||
self.meth = self.obj.foo
|
||||
|
||||
@kernel
|
||||
def run(self):
|
||||
self.meth(1)
|
||||
|
||||
bi = b()
|
||||
@kernel
|
||||
def entrypoint():
|
||||
bi.run()
|
Loading…
Reference in New Issue