aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-04-12 15:39:54 +0200
committerFelix Mulder <felix.mulder@gmail.com>2017-04-18 16:55:39 +0200
commitd355f8fe28218b1e8b984d6d491f02c414e922d5 (patch)
tree0e6f9163b1c8a2b08508937f4868a016f5424b00
parentab124cb8cda3ab65b0195f1a7f74006c24ebe7ab (diff)
downloaddotty-d355f8fe28218b1e8b984d6d491f02c414e922d5.zip
dotty-d355f8fe28218b1e8b984d6d491f02c414e922d5.tar.gz
dotty-d355f8fe28218b1e8b984d6d491f02c414e922d5.tar.bz2
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.
-rw-r--r--compiler/src/dotty/tools/dotc/core/TypeErasure.scala4
1 files 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 f357526..02f1f54 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 =>