Skip to content

Make sure annotations are typed in expression contexts #16699

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

Merged
merged 2 commits into from
Jan 15, 2023

Conversation

odersky
Copy link
Contributor

@odersky odersky commented 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 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

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
Since ExprOwner was only used in establishing annotation contexts,
and was not fully effective there either, we better drop it. This
means every annotation of a class member gets its own separate localDummy
owner.
@odersky odersky merged commit ed5b119 into scala:main Jan 15, 2023
@odersky odersky deleted the fix-15054 branch January 15, 2023 10:46
@Kordyjan Kordyjan added this to the 3.3.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

names of anonymous functions generated as annotation arguments are not unique
3 participants