Skip to content

Commit e674b1e

Browse files
committed
Fix tuple erasure
1 parent 837afec commit e674b1e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

compiler/src/dotty/tools/dotc/core/TypeErasure.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,13 @@ class TypeErasure(sourceLanguage: SourceLanguage, semiEraseVCs: Boolean, isConst
693693
*/
694694
def eraseInfo(tp: Type, sym: Symbol)(using Context): Type =
695695
val tp1 = tp match
696-
case tp: MethodicType => integrateContextResults(tp, contextResultCount(sym))
697-
case _ => tp
696+
case tp: MethodicType =>
697+
integrateContextResults(tp, contextResultCount(sym))
698+
case tp: ClassInfo
699+
if defn.isTupleClass(sym) && tp.declaredParents.head.typeSymbol == defn.PairClass =>
700+
tp.derivedClassInfo(declaredParents = defn.ObjectType :: tp.declaredParents.tail)
701+
case _ =>
702+
tp
698703
tp1 match
699704
case ExprType(rt) =>
700705
if sym.is(Param) then apply(tp1)

0 commit comments

Comments
 (0)