aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-11-04 20:16:48 +0100
committerMartin Odersky <odersky@gmail.com>2014-11-09 19:08:59 +0100
commit3299df8baf74564627d474d47a26605b5e02a6d9 (patch)
treea5e7ce33f76c353dcf472dea6841594f591c349c
parent6098546fad7e6e8709cc18a126b0e655f439d5bc (diff)
downloaddotty-3299df8baf74564627d474d47a26605b5e02a6d9.tar.gz
dotty-3299df8baf74564627d474d47a26605b5e02a6d9.tar.bz2
dotty-3299df8baf74564627d474d47a26605b5e02a6d9.zip
Fix of computeDenot.
Since we demand that after erasure all TermRefs are SymDenotations we need to assure this when computing the denotations of term refs in new phases.
-rw-r--r--src/dotty/tools/dotc/core/Types.scala14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index d0ddfdd28..6dce5581d 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -1173,8 +1173,12 @@ object Types {
if (newd.exists) newd else d.staleSymbolError
}
case d =>
- if (d.validFor.runId == ctx.period.runId) d.current
- else loadDenot
+ if (d.validFor.runId != ctx.period.runId)
+ loadDenot
+ else if (ctx.erasedTypes && lastSymbol != null)
+ denotOfSym(lastSymbol) // avoid keeping non-sym denotations after erasure; they violate the assertErased contract
+ else
+ d.current
}
if (ctx.typerState.ephemeral) record("ephemeral cache miss: loadDenot")
else if (d.exists) {
@@ -1623,8 +1627,10 @@ object Types {
final class CachedSuperType(thistpe: Type, supertpe: Type) extends SuperType(thistpe, supertpe)
object SuperType {
- def apply(thistpe: Type, supertpe: Type)(implicit ctx: Context): Type =
+ def apply(thistpe: Type, supertpe: Type)(implicit ctx: Context): Type = {
+ assert(thistpe != NoPrefix)
unique(new CachedSuperType(thistpe, supertpe))
+ }
}
/** A constant type with single `value`. */
@@ -1817,7 +1823,7 @@ object Types {
}
catch {
case ex: AssertionError =>
- println(i"failure while taking result signture of $resultType")
+ println(i"failure while taking result signture of $this: $resultType")
throw ex
}