Skip to content

Commit

Permalink
Compute the original qualifier type before erasure
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
odersky committed Jun 26, 2023
1 parent 8231a48 commit 996bb15
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/transform/Erasure.scala
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,9 @@ object Erasure {
val symIsPrimitive = sym.owner.isPrimitiveValueClass

def originalQual: Type =
erasure(tree.qualifier.typeOpt.widen.finalResultType)
erasure(
inContext(preErasureCtx):
tree.qualifier.typeOpt.widen.finalResultType)

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

0 comments on commit 996bb15

Please sign in to comment.