Skip to content

Commit 8bb3f06

Browse files
committed
Fix #5090: Fix condition in erasedResult type
1 parent 00e396c commit 8bb3f06

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-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
@@ -507,7 +507,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
507507
// constructor method should not be semi-erased.
508508
else if (isConstructor && isDerivedValueClass(sym)) eraseNormalClassRef(tp)
509509
else this(tp)
510-
case AppliedType(tycon, _) if !erasureDependsOnArgs(tycon) =>
510+
case AppliedType(tycon, _) if tycon.typeSymbol.isClass && !erasureDependsOnArgs(tycon) =>
511511
eraseResult(tycon)
512512
case _ =>
513513
this(tp)

tests/pos/i5090.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class TypeAlias {
2+
type T[X] = X
3+
def a(i: T[Int]): T[Int] = i
4+
}

0 commit comments

Comments
 (0)