scala/scala — pull request #3177 by dotta (2013-11-22 12:46:19+00:00)
Title: SI-7548 askTypeAt returns the same type whether the file was fully type-checked or targeted type-checked

When asking for targeted typecheck, the located tree may have overloaded types
is the source isn't yet fully typechecked (e.g., a select tree for an
overloaded method). This is problematic as it can lead to unknown 'hovers',
broken hyperlinking that suddenly starts working, unresolved ScalaDoc comments,
and similar, in the Scala IDE.

With this commit we are hardening the contract of `askTypeAt` to return the
same type whether the file was fully type-checked or targeted type-checked.
This is done by preventing the typechecker to stop too early if the `located`
tree has an overloaded type.

Unfortunately, there is no easy way to provide a test together with this fix.
The faulty behavior is hard to consistently reproduce, as it depends on timing.
However, I've manually tested this by inserting a `Thread.sleep` just before
typechecking in `Global.backgroundCompile`, and checked that an `askTypeAt` on
an select tree for an overloaded method now does return a fully resolved symbol.