-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
embedding: reimplement 373578b properly.
The core of the problem that 373578b was attempting to solve is that diagnostics sometimes should be chained; one way of chaining is the loc.expanded_from feature, which handles macro-like expansion, but another is providing context. Before this commit, context was provided using an ad-hoc override of a diagnostic engine, which did not work in cases where diagnostic engine was not threaded through the call stack. This commit uses the newly added pythonparser context feature to elegantly handle the problem.
whitequark
committed
Jul 7, 2016
1 parent
6a1706b
commit 2678bb0
Showing
2 changed files
with
48 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s 2>%t | ||
# RUN: OutputCheck %s --file-to-check=%t | ||
|
||
from artiq.language.core import * | ||
from artiq.language.types import * | ||
|
||
class foo: | ||
# CHECK-L: ${LINE:+2}: fatal: this function cannot be called as an RPC | ||
@host_only | ||
def pause(self): | ||
pass | ||
|
||
x = foo() | ||
|
||
@kernel | ||
def entrypoint(): | ||
# CHECK-L: ${LINE:+2}: note: in function called remotely here | ||
# CHECK-L: ${LINE:+1}: note: while inferring a type for an attribute 'pause' of a host object | ||
x.pause() |