From d355f8fe28218b1e8b984d6d491f02c414e922d5 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 12 Apr 2017 15:39:54 +0200 Subject: Dealias before type erasing ... and likewise for taking a signature. The previous case worked in all cases except when faced with an alias like `type Id[T] = T`. In that case, it would disregard the argument and erase to Object. --- compiler/src/dotty/tools/dotc/core/TypeErasure.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala index f35752644..02f1f549f 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 match { + private def apply(tp: Type)(implicit ctx: Context): Type = tp.dealias match { case _: ErasedValueType => tp case tp: TypeRef => @@ -487,7 +487,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 match { + tp.dealias match { case ErasedValueType(_, underlying) => sigName(underlying) case tp: TypeRef => -- cgit v1.2.3