Skip to content

Conversation

@tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Oct 25, 2021

Previously, it was not possible to find if a given method was for example annotated with @main, which will be useful for run/debug code lenses. Now, they should be correctly saved.

The only issue seems to be @specialized which is currently producing empty type, anone knows what is going on?

CC @tanishiking

@tgodzik tgodzik requested a review from bishabosha October 25, 2021 16:54
Previously, it was not possible to find if a given method was for example annotated with @main, which will be useful for run/debug code lenses. Now, they should be correctly saved.

The only issue seems to be `@specialized` which is currently producing empty type, anone knows what is going on?
val signature = s.info.toSemanticSig(s)
val symbolAnnotations = s.annotations.collect{
case annot if annot.symbol != defn.BodyAnnot && annot.symbol != defn.ChildAnnot =>
Annotation(annot.symbol.typeRef.toSemanticType(annot.symbol))
Copy link
Member

@bishabosha bishabosha Oct 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if the annotation has type parameters? like @throws[java.io.IOException]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ach, that didn't work. I added a test case and switched how we get the type in the last commit.

@tgodzik tgodzik requested a review from bishabosha October 27, 2021 10:00
val symbolAnnotations = s.annotations.collect{
case annot if annot.symbol != defn.BodyAnnot && annot.symbol != defn.ChildAnnot =>
Annotation(annot.symbol.typeRef.toSemanticType(annot.symbol))
Annotation(annot.tree.typeOpt.toSemanticType(annot.symbol))
Copy link
Member

@bishabosha bishabosha Oct 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the tree has NoType then should we skip adding an annotation? Although as .tree is a tpd.Tree you should be able to call .tpe instead of .typeOpt without any issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed! Using tpe instead

@bishabosha bishabosha enabled auto-merge October 27, 2021 10:34
@bishabosha bishabosha merged commit e1930d1 into scala:master Oct 27, 2021
@Kordyjan Kordyjan added this to the 3.1.2 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants