Skip to content

Commit 3b0337a

Browse files
committed
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.
1 parent 741ee16 commit 3b0337a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

+2-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 match {
358+
private def apply(tp: Type)(implicit ctx: Context): Type = tp.dealias match {
359359
case _: ErasedValueType =>
360360
tp
361361
case tp: TypeRef =>
@@ -487,7 +487,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
487487
* Need to ensure correspondence with erasure!
488488
*/
489489
private def sigName(tp: Type)(implicit ctx: Context): TypeName = try {
490-
tp match {
490+
tp.dealias match {
491491
case ErasedValueType(_, underlying) =>
492492
sigName(underlying)
493493
case tp: TypeRef =>

0 commit comments

Comments
 (0)