Skip to content

SymDenotation.annotations fails to complete annotations of DefDef #341

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

Closed
olhotak opened this issue Jan 30, 2015 · 2 comments
Closed

SymDenotation.annotations fails to complete annotations of DefDef #341

olhotak opened this issue Jan 30, 2015 · 2 comments

Comments

@olhotak
Copy link
Contributor

olhotak commented Jan 30, 2015

The annotations of a DefDef are added to its SymDenotation at the beginning of typedDefDef by addTypedModifiersAnnotations(ddef, sym).

The code of SymDenotation.annotations is ensureCompleted(); myAnnotations.

However, the completer for a DefDef does not trigger a call to typedDefDef. The completer types only the tpt and the rhs of the DefDef, but not the DefDef itself. Therefore, ensureCompleted() does not actually complete the annotations.

SymDenotation.annotations therefore returns either no annotations or the correct annotations, dependent only on whether a call to typedDefDef happens to have already been triggered by something else.

@olhotak
Copy link
Contributor Author

olhotak commented Feb 12, 2015

At yesterday's Dotty meeting, it was suggested that completion of annotations (addTypedModifiersAnnotations) should be done not in typedDefDef, but at the beginning of the completer of the DefDef (and similarly for ValDef, TypeDef, and ClassDef).

Doing this introduces a cyclic reference error in tests/pos/java-interop/t1782/Test_1.scala, which contains the following code:

@ImplementedBy(classOf[Provider]) trait Service {
  // ...
}

class Provider extends Service {
  // ...
}

To complete Provider, we must complete Service. To complete Service, we now must complete its annotation. To complete the annotation of Service, we must complete Provider, hence the cycle.

@smarter
Copy link
Member

smarter commented Jan 10, 2018

Annotations are entered before completing definitions since #1693 which should take care of this.

@smarter smarter closed this as completed Jan 10, 2018
tgodzik added a commit to tgodzik/scala3 that referenced this issue Apr 29, 2025
Backport "Dealias when looking into imports" to 3.3 LTS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants