Skip to content

Commit 9bb3551

Browse files
committed
Retract of optimization in computeDenot
Needs a weakening of an assertion in assertErased
1 parent 764c1f6 commit 9bb3551

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/dotty/tools/dotc/core/Types.scala

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,8 +1175,15 @@ object Types {
11751175
case d =>
11761176
if (d.validFor.runId != ctx.period.runId)
11771177
loadDenot
1178-
else if (ctx.erasedTypes && lastSymbol != null)
1179-
denotOfSym(lastSymbol) // avoid keeping non-sym denotations after erasure; they violate the assertErased contract
1178+
// The following branch was used to avoid an assertErased error.
1179+
// It's idea was to void keeping non-sym denotations after erasure
1180+
// since they violate the assertErased contract. But the problem is
1181+
// that when seen again in an earlier phase the denotation is
1182+
// still seen as a SymDenotation, whereas it should be a SingleDenotation.
1183+
// That's why the branch is disabled.
1184+
//
1185+
// else if (ctx.erasedTypes && lastSymbol != null)
1186+
// denotOfSym(lastSymbol)
11801187
else
11811188
d.current
11821189
}

src/dotty/tools/dotc/transform/Erasure.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ class Erasure extends Phase with DenotTransformer { thisTransformer =>
9494
if (ctx.mode.isExpr)
9595
tree.tpe match {
9696
case ref: TermRef =>
97-
assert(ref.denot.isInstanceOf[SymDenotation],
97+
assert(ref.denot.isInstanceOf[SymDenotation] ||
98+
ref.denot.isInstanceOf[UniqueRefDenotation],
9899
i"non-sym type $ref of class ${ref.getClass} with denot of class ${ref.denot.getClass} of $tree")
99100
case _ =>
100101
}

0 commit comments

Comments
 (0)