File tree 2 files changed +14
-4
lines changed
compiler/src/dotty/tools/dotc/core 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -722,7 +722,7 @@ object Denotations {
722
722
* if denotation is no longer valid.
723
723
*/
724
724
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) =>
726
726
assert(ctx.runId > validFor.runId || ctx.settings.YtestPickler .value, // mixing test pickler with debug printing can travel back in time
727
727
s " denotation $denot invalid in run ${ctx.runId}. ValidFor: $validFor" )
728
728
var d : SingleDenotation = denot
@@ -918,13 +918,15 @@ object Denotations {
918
918
old.nextInRun = this
919
919
}
920
920
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 = {
922
925
def ownerMsg = this match {
923
926
case denot : SymDenotation => s " in ${denot.owner}"
924
927
case _ => " "
925
928
}
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}"
928
930
}
929
931
930
932
/** 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 =>
99
99
explain(" denotation is not a SymDenotation" )
100
100
}
101
101
}
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
+
102
110
}
103
111
104
112
object SymDenotations {
You can’t perform that action at this time.
0 commit comments