-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reference to quoted local member fails to in quote pickling #17103
Labels
area:metaprogramming:quotes
Issues related to quotes and splices
area:pickling
itype:bug
itype:crash
Milestone
Comments
nicolasstucki
added
itype:bug
area:pickling
itype:crash
area:metaprogramming:quotes
Issues related to quotes and splices
labels
Mar 15, 2023
This should not compile as it is impossible to pickle the selection of |
In theory, to make it work we would need to write a static interface on which we can select trait C0:
val d: Int
def test(using Quotes): Expr[Unit] =
'{
trait C extends C0:
val d: Int
val c: C = ???
${
val expr = '{
val cRef: c.type = ???
cRef.d
()
}
expr
}
} But this also fails with the same error. But it should work. |
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Mar 15, 2023
If an inner quote selects a symbol that is defined in an outer quote we need to transform it or reject it. The issue is that the inner quote cannot contain a reference to the type of the class defined in the outer quote. Any such reference is erased the parents of that class that are statically know outside those quotes. If the selected symbol is overriding a symbol in one of those statically known classes, we can use that overridden symbol instead. If not we have to reject the code. Fixes scala#17103
nicolasstucki
added a commit
that referenced
this issue
Mar 21, 2023
If an inner quote selects a symbol that is defined in an outer quote we need to transform it or reject it. The issue is that the inner quote cannot contain a reference to the type of the class defined in the outer quote. Any such reference is erased the parents of that class that are statically know outside those quotes. If the selected symbol is overriding a symbol in one of those statically known classes, we can use that overridden symbol instead. If not we have to reject the code. Fixes #17103
Dedelweiss
pushed a commit
to Dedelweiss/dotty
that referenced
this issue
Apr 17, 2023
If an inner quote selects a symbol that is defined in an outer quote we need to transform it or reject it. The issue is that the inner quote cannot contain a reference to the type of the class defined in the outer quote. Any such reference is erased the parents of that class that are statically know outside those quotes. If the selected symbol is overriding a symbol in one of those statically known classes, we can use that overridden symbol instead. If not we have to reject the code. Fixes scala#17103
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area:metaprogramming:quotes
Issues related to quotes and splices
area:pickling
itype:bug
itype:crash
Compiler version
3.3.1-RC1-bin-20230313-f28d708-NIGHTLY and before
Minimized code
Output (click arrow to expand)
The text was updated successfully, but these errors were encountered: