Skip to content

Commit 6a0c581

Browse files
authored
Merge pull request #2236 from dotty-staging/fix-#2234
Fix #2234: Dealias before type erasing
2 parents ab124cb + 37120df commit 6a0c581

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

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

+4
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
377377
defn.FunctionType(0)
378378
case AndType(tp1, tp2) =>
379379
erasedGlb(this(tp1), this(tp2), isJava)
380+
case tp: HKApply =>
381+
apply(tp.superType)
380382
case OrType(tp1, tp2) =>
381383
ctx.typeComparer.orType(this(tp1), this(tp2), erased = true)
382384
case tp: MethodType =>
@@ -508,6 +510,8 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
508510
normalizeClass(sym.asClass).fullName.asTypeName
509511
case defn.ArrayOf(elem) =>
510512
sigName(this(tp))
513+
case tp: HKApply =>
514+
sigName(tp.superType)
511515
case JavaArrayType(elem) =>
512516
sigName(elem) ++ "[]"
513517
case tp: TermRef =>

tests/pos/i2234.scala

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
object Test {
2+
type Dummy[A] = A
3+
4+
def a(d: Dummy[String]) = ()
5+
def a(d: Dummy[Int]) = ()
6+
7+
implicit def dummy[A]: Dummy[A] = null.asInstanceOf[A]
8+
def m(x: List[String])(implicit d: Dummy[String]) = "string"
9+
def m(x: List[Int])(implicit d: Dummy[Int]) = "int"
10+
11+
m(List(1, 2, 3))
12+
m(List("a"))
13+
}

0 commit comments

Comments
 (0)