Skip to content

Commit ee7e02e

Browse files
committed
Alternative fix
Special case HKApply only. This is simpler and potentially more efficient.
1 parent 9e620cb commit ee7e02e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
355355
* - For NoType or NoPrefix, the type itself.
356356
* - For any other type, exception.
357357
*/
358-
private def apply(tp: Type)(implicit ctx: Context): Type = tp.dealias match {
358+
private def apply(tp: Type)(implicit ctx: Context): Type = tp match {
359359
case _: ErasedValueType =>
360360
tp
361361
case tp: TypeRef =>
@@ -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 =>
@@ -487,7 +489,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
487489
* Need to ensure correspondence with erasure!
488490
*/
489491
private def sigName(tp: Type)(implicit ctx: Context): TypeName = try {
490-
tp.dealias match {
492+
tp match {
491493
case ErasedValueType(_, underlying) =>
492494
sigName(underlying)
493495
case tp: TypeRef =>
@@ -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 =>

0 commit comments

Comments
 (0)