aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymDenotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-04-03 15:19:57 +0200
committerMartin Odersky <odersky@gmail.com>2015-04-07 23:53:04 +0200
commit1a0afa8d5b04cc491bfb72636b2042a506a39f29 (patch)
tree6e89409ca6fbfc102627313105578f583dfae542 /src/dotty/tools/dotc/core/SymDenotations.scala
parentaa11237158ddf5cdbf25acc6304efb50ff10d49d (diff)
downloaddotty-1a0afa8d5b04cc491bfb72636b2042a506a39f29.tar.gz
dotty-1a0afa8d5b04cc491bfb72636b2042a506a39f29.tar.bz2
dotty-1a0afa8d5b04cc491bfb72636b2042a506a39f29.zip
Test stillValid at initial phase, revive -twice
stillValid should always be tested at the phase where the initial denotation is defined. If we do not do this we get false stale symbol errors. Here is a scenario: To `bringForward` `Predef$$ArrowAsscoc`, we check whether its initial denotation has an owner which contains the denotation as one of its members. But if we do this at a later phase (e.g. GenBCode), the owner of the initial denotation is Predef, but Predef no longer contains ArraoAssoc - it lost the member at flatten. With this fix we can run everything with -twice, except dotc_core. I left a comment what goes wrong there.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 990c6e317..e572f129b 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -41,15 +41,19 @@ trait SymDenotations { this: Context =>
def stillValid(denot: SymDenotation): Boolean =
if (denot is ValidForever) true
- else try {
- val owner = denot.owner.denot
- stillValid(owner) && (
- !owner.isClass
- || (owner.unforcedDecls.lookupAll(denot.name) contains denot.symbol)
- || denot.isSelfSym
- )
- } catch {
- case ex: StaleSymbol => false
+ else {
+ val initial = denot.initial
+ if (initial ne denot)
+ ctx.withPhase(initial.validFor.firstPhaseId).stillValid(initial.asSymDenotation)
+ else try {
+ val owner = denot.owner.denot
+ stillValid(owner) && (
+ !owner.isClass
+ || (owner.unforcedDecls.lookupAll(denot.name) contains denot.symbol)
+ || denot.isSelfSym)
+ } catch {
+ case ex: StaleSymbol => false
+ }
}
}
@@ -72,8 +76,6 @@ object SymDenotations {
/** Debug only
override def validFor_=(p: Period) = {
- if (name == "Trees".toTermName && p.runId == 3)
- assert(symbol.id != 6161)
super.validFor_=(p)
}
*/