Skip to content

Commit 73bfbe5

Browse files
author
whitequark
committedMar 3, 2016
compiler: reject lambdas used as kernel functions (fixes #313).
1 parent cfe72c7 commit 73bfbe5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎artiq/compiler/embedding.py

+10
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,16 @@ def _quote_function(self, function, loc):
742742
else:
743743
if hasattr(function, "artiq_embedded"):
744744
if function.artiq_embedded.function is not None:
745+
if function.__name__ == "<lambda>":
746+
note = diagnostic.Diagnostic("note",
747+
"lambda created here", {},
748+
self._function_loc(function.artiq_embedded.function))
749+
diag = diagnostic.Diagnostic("fatal",
750+
"lambdas cannot be used as kernel functions", {},
751+
loc,
752+
notes=[note])
753+
self.engine.process(diag)
754+
745755
# Insert the typed AST for the new function and restart inference.
746756
# It doesn't really matter where we insert as long as it is before
747757
# the final call.

0 commit comments

Comments
 (0)
Please sign in to comment.