scala/scala — pull request #3358 by dotta (2014-01-13 09:30:10+00:00)
Title: SI-8136 Replaced `askTypeAt` with `askEnclosingTreesAt` in `CompilerControl`

While working on a fix for SI-8125, I found out that the Trees with
synthetic `apply` where constructed with the wrong kind of positions on
purpose. The rationale for doing so was that the Scala IDE relies on
opaque range positions for providing hyperlinking, and we wanted to
support hyperlinkling to `apply` definition when hovering on a qualifier
with a synthetic `apply`. However, if the Select Tree containing the
`apply` was given a transparent position (as it should be the case, and
that's indeed the issue I'm fixing with SI-8125), the Scala IDE would no
longer offer hyperlinking to `apply` declaration (some more information
about this can be found in this discussion
https://github.com/scala/scala/pull/1251/files#r1573933).

The proposed solution was to change the implementation of
`askTypeAt(pos)` to return the parents' chain enclosing `pos`, instead
of only the innermost tree. However, making this change would be both
source and binary incompatible, because the signature of the method
would be different. Hence, I'm taking a different road here and adding a
new method to the `CompilerControl` API to carry out the desired
functionality: `askEnclosingTreesAt(pos)`. This method will allow us to
navigate the parents chain of the Tree found at the passed `pos`, making
it possible to fix SI-8125 and still be able to offer hyperlinking on
synthetic `apply`.

review by @dragos