diff options
author | Martin Odersky <odersky@gmail.com> | 2015-06-16 13:20:19 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-06-16 16:42:54 +0200 |
commit | bb940560529ba460af4caa967caaa7f34f944b04 (patch) | |
tree | 5eb4ff7ba0bfaf171e3d26bf8dddfeb86ddc80ef | |
parent | 78fae1152a7b381af4639d3d66ed637eac3ca9d0 (diff) | |
download | dotty-bb940560529ba460af4caa967caaa7f34f944b04.tar.gz dotty-bb940560529ba460af4caa967caaa7f34f944b04.tar.bz2 dotty-bb940560529ba460af4caa967caaa7f34f944b04.zip |
Avoid spurious StaleSymbol error in <refinement> members
Refinement classes and their members could give spurious stale symbol errors if the
symbol is loaded in a different run than the classfile containing it. The problem
is that refinement classes do not form part of the scope of their owners. The fix
assumes that refinement classes are always "stillValid".
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 3 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Symbols.scala | 2 | ||||
-rw-r--r-- | tests/run/Course-2002-10.check (renamed from tests/pending/run/Course-2002-10.check) | 0 | ||||
-rw-r--r-- | tests/run/Course-2002-10.scala (renamed from tests/pending/run/Course-2002-10.scala) | 0 |
4 files changed, 3 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index d2b0d5030..fb26b2540 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -40,7 +40,7 @@ trait SymDenotations { this: Context => } def stillValid(denot: SymDenotation): Boolean = - if (denot is ValidForever) true + if (denot.is(ValidForever) || denot.isRefinementClass) true else { val initial = denot.initial if (initial ne denot) @@ -49,6 +49,7 @@ trait SymDenotations { this: Context => val owner = denot.owner.denot stillValid(owner) && ( !owner.isClass + || owner.isRefinementClass || (owner.unforcedDecls.lookupAll(denot.name) contains denot.symbol) || denot.isSelfSym) } catch { diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala index 0478b1b7b..602bdba80 100644 --- a/src/dotty/tools/dotc/core/Symbols.scala +++ b/src/dotty/tools/dotc/core/Symbols.scala @@ -408,7 +408,7 @@ object Symbols { /** Subclass tests and casts */ final def isTerm(implicit ctx: Context): Boolean = (if(isDefinedInCurrentRun) lastDenot else denot).isTerm - + final def isType(implicit ctx: Context): Boolean = (if(isDefinedInCurrentRun) lastDenot else denot).isType diff --git a/tests/pending/run/Course-2002-10.check b/tests/run/Course-2002-10.check index 207b671f0..207b671f0 100644 --- a/tests/pending/run/Course-2002-10.check +++ b/tests/run/Course-2002-10.check diff --git a/tests/pending/run/Course-2002-10.scala b/tests/run/Course-2002-10.scala index 4cfa1deb0..4cfa1deb0 100644 --- a/tests/pending/run/Course-2002-10.scala +++ b/tests/run/Course-2002-10.scala |