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
Wrong Tree returned by askTypeAt
(wrong hyperlink)
#7915
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7915?orig=1
|
@dotta said: |
@retronym said:
|
@dragos said: |
Mirko Stocker (misto) said: |
@dotta said: Backport to 2.10.x scala/scala#3157 |
@dotta said: |
Mirko Stocker (misto) said: |
@JamesIry said: |
I've debugged the problem inside the Scala IDE, and the reason why this happen is that
askTypeAt
returns the enclosingfoo
DefDef method symbol, instead of the expected SelectBar.bar
node. The enclosing method is returned becuase all Trees inside the method block have a TransparentPosition, all the way down. The impelmentation ofaskTypeAt
relies onRangePositions.Locator.traverse
to return the deepest, non-transparent, tree that includes the passed position. And, because all positions are transparent inside thefoo
method's body, then thefoo
symbol is returned.An additional interesting fact is that it looks like one of the transformation
happening during typechecking is to blame for updating the Tree with the wrong kind of positions. In fact, if the source file isn't typechecked, the correct symbol is returned.
Attached, you can find a patch that demonstrates the issue by running the presentation compiler in isolation. To run the test, simply type: ./test/partest test/files/presentation/t0000
The text was updated successfully, but these errors were encountered: