forked from M-Labs/artiq
1
0
Fork 0

compiler: reject lambdas used as kernel functions (fixes #313).

This commit is contained in:
whitequark 2016-03-03 08:33:28 +00:00
parent cfe72c72a2
commit 73bfbe51db
1 changed files with 10 additions and 0 deletions

View File

@ -742,6 +742,16 @@ class Stitcher:
else:
if hasattr(function, "artiq_embedded"):
if function.artiq_embedded.function is not None:
if function.__name__ == "<lambda>":
note = diagnostic.Diagnostic("note",
"lambda created here", {},
self._function_loc(function.artiq_embedded.function))
diag = diagnostic.Diagnostic("fatal",
"lambdas cannot be used as kernel functions", {},
loc,
notes=[note])
self.engine.process(diag)
# Insert the typed AST for the new function and restart inference.
# It doesn't really matter where we insert as long as it is before
# the final call.