mirror of https://github.com/m-labs/artiq.git
compiler: don't crash printing locations of specialized functions.
Fixes #987.
This commit is contained in:
parent
8812824fb2
commit
f35f100110
|
@ -749,6 +749,11 @@ class Stitcher:
|
|||
quote_function=self._quote_function)
|
||||
|
||||
def _function_loc(self, function):
|
||||
if isinstance(function, SpecializedFunction):
|
||||
function = function.host_function
|
||||
if hasattr(function, 'artiq_embedded'):
|
||||
function = function.artiq_embedded.function
|
||||
|
||||
filename = function.__code__.co_filename
|
||||
line = function.__code__.co_firstlineno
|
||||
name = function.__code__.co_name
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s 2>%t
|
||||
# RUN: OutputCheck %s --file-to-check=%t
|
||||
|
||||
from artiq.experiment import *
|
||||
|
||||
class c():
|
||||
# CHECK-L: ${LINE:+2}: error: type annotation for argument 'x', 'None', is not an ARTIQ type
|
||||
@kernel
|
||||
def hello(self, x: None):
|
||||
pass
|
||||
|
||||
@kernel
|
||||
def run(self):
|
||||
self.hello(2)
|
||||
|
||||
i = c()
|
||||
@kernel
|
||||
def entrypoint():
|
||||
i.run()
|
Loading…
Reference in New Issue