Skip to content

Commit d010f84

Browse files
committed
Fix "Find all references" in the IDE with external projects
"Find all references" worked on dotty itself because all its dotty-compiled dependencies are internal, but in other projects it failed when trying to construct a SourceTree for trees in the dotty library, because sym.sourceFile returned null, because the SourceFile annotation pointed to a path that does not exist on the user filesystem. For now, we just discard these trees, but we need to find some way to match them with source jars.
1 parent 281416b commit d010f84

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/src/dotty/tools/dotc/interactive/SourceTree.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ case class SourceTree(tree: tpd.NameTree, source: SourceFile) {
3939
}
4040
object SourceTree {
4141
def fromSymbol(sym: ClassSymbol)(implicit ctx: Context): Option[SourceTree] = {
42-
if (sym == defn.SourceFileAnnot) None // FIXME: No SourceFile annotation on SourceFile itself
42+
if (sym == defn.SourceFileAnnot || // FIXME: No SourceFile annotation on SourceFile itself
43+
sym.sourceFile == null) // FIXME: We cannot deal with external projects yet
44+
None
4345
else {
4446
sym.tree match {
4547
case tree: tpd.TypeDef =>

0 commit comments

Comments
 (0)