From 02cffa49ede84dbd0dbb93329c9a4117251ca658 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 12 Apr 2017 23:56:57 +0200 Subject: Alternative fix Special case HKApply only. This is simpler and potentially more efficient. --- compiler/src/dotty/tools/dotc/core/TypeErasure.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala index 02f1f549f..1eb90b8eb 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala @@ -355,7 +355,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean * - For NoType or NoPrefix, the type itself. * - For any other type, exception. */ - private def apply(tp: Type)(implicit ctx: Context): Type = tp.dealias match { + private def apply(tp: Type)(implicit ctx: Context): Type = tp match { case _: ErasedValueType => tp case tp: TypeRef => @@ -377,6 +377,8 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean defn.FunctionType(0) case AndType(tp1, tp2) => erasedGlb(this(tp1), this(tp2), isJava) + case tp: HKApply => + apply(tp.superType) case OrType(tp1, tp2) => ctx.typeComparer.orType(this(tp1), this(tp2), erased = true) case tp: MethodType => @@ -487,7 +489,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean * Need to ensure correspondence with erasure! */ private def sigName(tp: Type)(implicit ctx: Context): TypeName = try { - tp.dealias match { + tp match { case ErasedValueType(_, underlying) => sigName(underlying) case tp: TypeRef => @@ -508,6 +510,8 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean normalizeClass(sym.asClass).fullName.asTypeName case defn.ArrayOf(elem) => sigName(this(tp)) + case tp: HKApply => + sigName(tp.superType) case JavaArrayType(elem) => sigName(elem) ++ "[]" case tp: TermRef => -- cgit v1.2.3