aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/core/Types.scala11
-rw-r--r--src/dotty/tools/dotc/transform/Erasure.scala3
2 files changed, 11 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 3953562b2..5d95fae76 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -1175,8 +1175,15 @@ object Types {
case d =>
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
+ // The following branch was used to avoid an assertErased error.
+ // It's idea was to void keeping non-sym denotations after erasure
+ // since they violate the assertErased contract. But the problem is
+ // that when seen again in an earlier phase the denotation is
+ // still seen as a SymDenotation, whereas it should be a SingleDenotation.
+ // That's why the branch is disabled.
+ //
+ // else if (ctx.erasedTypes && lastSymbol != null)
+ // denotOfSym(lastSymbol)
else
d.current
}
diff --git a/src/dotty/tools/dotc/transform/Erasure.scala b/src/dotty/tools/dotc/transform/Erasure.scala
index b51a2360e..0a34b9e7c 100644
--- a/src/dotty/tools/dotc/transform/Erasure.scala
+++ b/src/dotty/tools/dotc/transform/Erasure.scala
@@ -94,7 +94,8 @@ class Erasure extends Phase with DenotTransformer { thisTransformer =>
if (ctx.mode.isExpr)
tree.tpe match {
case ref: TermRef =>
- assert(ref.denot.isInstanceOf[SymDenotation],
+ assert(ref.denot.isInstanceOf[SymDenotation] ||
+ ref.denot.isInstanceOf[UniqueRefDenotation],
i"non-sym type $ref of class ${ref.getClass} with denot of class ${ref.denot.getClass} of $tree")
case _ =>
}