Skip to content

Commit 7f68493

Browse files
oderskyKordyjan
authored andcommitted
Compute the original qualifier type before erasure
The original qualifier type was computed in the wrong context. For the logic to make sense, it needs to compute the type before erasure and then erase that type. That fixes #17391 by now compiling it correctly, the same way Scala 2 does. [Cherry-picked 996bb15]
1 parent 0e65ae4 commit 7f68493

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,9 @@ object Erasure {
762762
val symIsPrimitive = sym.owner.isPrimitiveValueClass
763763

764764
def originalQual: Type =
765-
erasure(tree.qualifier.typeOpt.widen.finalResultType)
765+
erasure(
766+
inContext(preErasureCtx):
767+
tree.qualifier.typeOpt.widen.finalResultType)
766768

767769
if (qualIsPrimitive && !symIsPrimitive || qual.tpe.widenDealias.isErasedValueType)
768770
recur(box(qual))
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)