Skip to content

Commit 996bb15

Browse files
committed
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.
1 parent 8231a48 commit 996bb15

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
@@ -764,7 +764,9 @@ object Erasure {
764764
val symIsPrimitive = sym.owner.isPrimitiveValueClass
765765

766766
def originalQual: Type =
767-
erasure(tree.qualifier.typeOpt.widen.finalResultType)
767+
erasure(
768+
inContext(preErasureCtx):
769+
tree.qualifier.typeOpt.widen.finalResultType)
768770

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

0 commit comments

Comments
 (0)