scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

Annotations removed from the tree after `typer` #7404

Open scabug opened 11 years ago

scabug commented 11 years ago

Annotations are removed from mods in typer, and re-appear in corresponding symbols. However, this breaks the assumption that a (range) position can be mapped back to (a reasonable approximation of the) corresponding tree. This breaks everything in the IDE relative to annotations:

The "innermost enclosing tree" for an annotation position resolves to be the enclosing Template.

scabug commented 11 years ago

Imported From: https://issues.scala-lang.org/browse/SI-7404?orig=1 Reporter: @dragos Affected Versions: 2.10.1

scabug commented 11 years ago

@retronym said: @Iulian: Is this a regression?

scabug commented 10 years ago

@dragos said: Not as far as I know. I talked to @lrytz back then and he considered it a feature. But it would be great to find a solution and offer a better experience for IDE users.

scabug commented 10 years ago

@lrytz said (edited on May 16, 2014 12:08:03 PM UTC): I think we can just keep them. The only issues are confusion (annotations exist in two places after typing) and the memory they take. We could also do that just in the presentation compiler.

If we just don't clear remove them from the modifiers (Typer#typedModifiers), the trees will not be typed though. Is that a problem? We'd need to get the typed trees out of the AnnotationInfos otherwise, and plug them back into the modifiers.