File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -722,7 +722,7 @@ object Denotations {
722722 * if denotation is no longer valid.
723723 */
724724 private def bringForward ()(implicit ctx : Context ): SingleDenotation = this match {
725- case denot : SymDenotation if ctx.stillValid(denot) =>
725+ case denot : SymDenotation if ctx.stillValid(denot) || ctx.acceptStale(denot) =>
726726 assert(ctx.runId > validFor.runId || ctx.settings.YtestPickler .value, // mixing test pickler with debug printing can travel back in time
727727 s " denotation $denot invalid in run ${ctx.runId}. ValidFor: $validFor" )
728728 var d : SingleDenotation = denot
@@ -918,13 +918,15 @@ object Denotations {
918918 old.nextInRun = this
919919 }
920920
921- def staleSymbolError (implicit ctx : Context ) = {
921+ def staleSymbolError (implicit ctx : Context ) =
922+ throw new StaleSymbol (staleSymbolMsg)
923+
924+ def staleSymbolMsg (implicit ctx : Context ): String = {
922925 def ownerMsg = this match {
923926 case denot : SymDenotation => s " in ${denot.owner}"
924927 case _ => " "
925928 }
926- def msg = s " stale symbol; $this# ${symbol.id} $ownerMsg, defined in ${myValidFor}, is referred to in run ${ctx.period}"
927- throw new StaleSymbol (msg)
929+ s " stale symbol; $this# ${symbol.id} $ownerMsg, defined in ${myValidFor}, is referred to in run ${ctx.period}"
928930 }
929931
930932 /** The period (interval of phases) for which there exists
Original file line number Diff line number Diff line change @@ -99,6 +99,14 @@ trait SymDenotations { this: Context =>
9999 explain(" denotation is not a SymDenotation" )
100100 }
101101 }
102+
103+ /** Configurable: Accept stale symbol with warning if in IDE */
104+ def acceptStale (denot : SingleDenotation ): Boolean =
105+ (mode.is(Mode .Interactive ) && Config .ignoreStaleInIDE) && {
106+ ctx.warning(denot.staleSymbolMsg)
107+ true
108+ }
109+
102110}
103111
104112object SymDenotations {
You can’t perform that action at this time.
0 commit comments