Skip to content

Commit c566e60

Browse files
committed
Harden findGetter for IDE
Crash was observed where the assert is.
1 parent 34a2b96 commit c566e60

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

+6-2
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,12 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
366366
else if (cx.scope != cx.outer.scope &&
367367
cx.denotNamed(meth.name).hasAltWith(_.symbol == meth)) {
368368
val denot = cx.denotNamed(getterName)
369-
assert(denot.exists, s"non-existent getter denotation ($denot) for getter($getterName)")
370-
ref(TermRef(cx.owner.thisType, getterName, denot))
369+
if (denot.exists) ref(TermRef(cx.owner.thisType, getterName, denot))
370+
else {
371+
assert(ctx.mode.is(Mode.Interactive),
372+
s"non-existent getter denotation ($denot) for getter($getterName)")
373+
findGetter(cx.outer)
374+
}
371375
} else findGetter(cx.outer)
372376
}
373377
findGetter(ctx)

0 commit comments

Comments
 (0)