Skip to content

Commit 76af6c5

Browse files
committed
Fix Erasure of uniqueRefDenotations with different underlying type.
The bug happened for `new Tuple2[Int, Int](1, 2)._1`, if the last `._1` selection is done by symbol. This will create a uniqueRefDenotation with underlying type Int. This denotation has to be erased in conformance with underlying type, not with the observed type before erasure, as otherwise you'd think that `_1` on topple returns Int.
1 parent 232761c commit 76af6c5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
440440
// but potentially re-introduced by ResolveSuper, when we add
441441
// forwarders to mixin methods.
442442
// See doc comment for ElimByName for speculation how we could improve this.
443-
else MethodType(Nil, Nil, eraseResult(rt))
443+
else MethodType(Nil, Nil, eraseResult(sym.info.finalResultType))
444444
case tp: PolyType =>
445445
eraseResult(tp.resultType) match {
446446
case rt: MethodType => rt

0 commit comments

Comments
 (0)