Skip to content

Commit eb93112

Browse files
committed
Harden IDE
In interactive mode, allow uncompleted symbols with completers from previous runs. This is possible due to the way we bring forwward stale symbols. Liek in manual cleanup in InteractiveDriver, we set the info of such symbols to UnspecifiedError.
1 parent dd95817 commit eb93112

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

compiler/src/dotty/tools/dotc/core/Denotations.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ object Denotations {
761761
def invalidateInheritedInfo(): Unit = ()
762762

763763
private def updateValidity()(implicit ctx: Context): this.type = {
764-
assert(ctx.runId > validFor.runId || ctx.settings.YtestPickler.value, // mixing test pickler with debug printing can travel back in time
764+
assert(ctx.runId >= validFor.runId || ctx.settings.YtestPickler.value, // mixing test pickler with debug printing can travel back in time
765765
s"denotation $this invalid in run ${ctx.runId}. ValidFor: $validFor")
766766
var d: SingleDenotation = this
767767
do {

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,8 +754,11 @@ class Namer { typer: Typer =>
754754
else levels(c.outer) + 1
755755
println(s"!!!completing ${denot.symbol.showLocated} in buried typerState, gap = ${levels(ctx)}")
756756
}
757-
assert(ctx.runId == creationContext.runId, s"completing $denot in wrong run ${ctx.runId}, was created in ${creationContext.runId}")
758-
completeInCreationContext(denot)
757+
if (ctx.runId > creationContext.runId) {
758+
assert(ctx.mode.is(Mode.Interactive), s"completing $denot in wrong run ${ctx.runId}, was created in ${creationContext.runId}")
759+
denot.info = UnspecifiedErrorType
760+
}
761+
else completeInCreationContext(denot)
759762
}
760763

761764
private def addInlineInfo(denot: SymDenotation) = original match {

0 commit comments

Comments
 (0)