-
Notifications
You must be signed in to change notification settings - Fork 1.1k
names of anonymous functions generated as annotation arguments are not unique #15054
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
Comments
similar issue for annotations on function arguments |
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
Jan 14, 2023
The previous logic tried but had holes. A local context was established in `typedStats#localCtx` but that context was not found in annotations that were typechecked in the completer of the definition they decorated. We are now more through and always allocate a localDummy as new owner if the owner would otherwise we a class. This means that closures in annotation arguments will have a term as owner, and therefore will be allocated in distinct local scopes. Fixes scala#15054 This broke two pickling tests where the source defined a local class in an argument to an annotation of a toplevel class. Somehow a position for these argument classes could not be found when unpickling. But it does work for classes inside other classes or objects. I changed the tests to nested classes, and kept one of the originals in the pickling exclude list.
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
Jan 14, 2023
The previous logic tried but had holes. A local context was established in `typedStats#localCtx` but that context was not found in annotations that were typechecked in the completer of the definition they decorated. We are now more through and always allocate a localDummy as new owner if the owner would otherwise we a class. This means that closures in annotation arguments will have a term as owner, and therefore will be allocated in distinct local scopes. Fixes scala#15054
Thanks for the report, and sorry it took so long to fix. |
Thanks for the fix :) |
odersky
added a commit
that referenced
this issue
Jan 15, 2023
The previous logic tried but had holes. A local context was established in `typedStats#localCtx` but that context was not found in annotations that were typechecked in the completer of the definition they decorated. We are now more thorough and always allocate a localDummy as new owner if the owner would otherwise be a class. This means that closures in annotation arguments will have a term as owner, and therefore will be allocated in distinct local scopes. Fixes #15054
little-inferno
pushed a commit
to little-inferno/dotty
that referenced
this issue
Jan 25, 2023
The previous logic tried but had holes. A local context was established in `typedStats#localCtx` but that context was not found in annotations that were typechecked in the completer of the definition they decorated. We are now more through and always allocate a localDummy as new owner if the owner would otherwise we a class. This means that closures in annotation arguments will have a term as owner, and therefore will be allocated in distinct local scopes. Fixes scala#15054
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler version
3.1.1
Minimized code
https://scastie.scala-lang.org/JyCTJBMCRIKW73xNmAuaLA
Output
Expectation
generated anonymous functions should have unique names
The text was updated successfully, but these errors were encountered: