File tree 2 files changed +14
-2
lines changed
compiler/src/dotty/tools/dotc/transform
language-server/test/dotty/tools/languageserver
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -150,8 +150,9 @@ class SymUtils(val self: Symbol) extends AnyVal {
150
150
151
151
/** Is symbol directly or indirectly owned by a term symbol? */
152
152
@ tailrec final def isLocal (implicit ctx : Context ): Boolean = {
153
- val owner = self.owner
154
- if (owner.isTerm) true
153
+ val owner = self.maybeOwner
154
+ if (! owner.exists) false
155
+ else if (owner.isTerm) true
155
156
else if (owner.is(Package )) false
156
157
else owner.isLocal
157
158
}
Original file line number Diff line number Diff line change @@ -367,4 +367,15 @@ class DefinitionTest {
367
367
.definition(m17 to m18, List (m11 to m12))
368
368
.definition(m19 to m20, List (m13 to m14))
369
369
}
370
+
371
+ @ Test def definitionDoesNotExist : Unit = withSources(
372
+ code """ object Foo {
373
+ | ${m1}unknown1 ${m2}
374
+ | ${m3}unknown2 ${m4}. ${m5}unknown3 ${m6}
375
+ | Foo. ${m7}unknown4 ${m8}
376
+ |} """ )
377
+ .definition(m1 to m2, Nil )
378
+ .definition(m3 to m4, Nil )
379
+ .definition(m5 to m6, Nil )
380
+ .definition(m7 to m8, Nil )
370
381
}
You can’t perform that action at this time.
0 commit comments