forked from M-Labs/artiq
parent
c585784cd9
commit
2f37b1d1c0
|
@ -561,7 +561,11 @@ class StitchingInferencer(Inferencer):
|
||||||
# of having the host-to-ARTIQ mapping code in only one place and
|
# of having the host-to-ARTIQ mapping code in only one place and
|
||||||
# also immediately getting proper diagnostics on type errors.
|
# also immediately getting proper diagnostics on type errors.
|
||||||
attr_value = getattr(object_value, attr_name)
|
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:
|
# In cases like:
|
||||||
# class c:
|
# class c:
|
||||||
# @kernel
|
# @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