diff options
author | Martin Odersky <odersky@gmail.com> | 2014-08-30 13:02:56 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-08-30 13:02:56 +0200 |
commit | 4041c5d590f78323d640c6eec7e370a37a01c416 (patch) | |
tree | 15e33ffb26e1bfd4c47842670dee696c582322bf /src/dotty/tools/dotc/core/TypeApplications.scala | |
parent | 5362969b55cc73c22ea959d1960e3696a801c469 (diff) | |
download | dotty-4041c5d590f78323d640c6eec7e370a37a01c416.tar.gz dotty-4041c5d590f78323d640c6eec7e370a37a01c416.tar.bz2 dotty-4041c5d590f78323d640c6eec7e370a37a01c416.zip |
Ensure that after erasure all types are erased.
Defines a predicate isErasedTypes and checks that all tree types
and their widened underlying types are erased.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeApplications.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeApplications.scala | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala index 2c8e9902b..bf756facf 100644 --- a/src/dotty/tools/dotc/core/TypeApplications.scala +++ b/src/dotty/tools/dotc/core/TypeApplications.scala @@ -41,8 +41,6 @@ import TypeApplications._ /** A decorator that provides methods for modeling type application */ class TypeApplications(val self: Type) extends AnyVal { - def canHaveTypeParams(implicit ctx: Context) = !ctx.erasedTypes || self.isRef(defn.ArrayClass) - /** The type parameters of this type are: * For a ClassInfo type, the type parameters of its class. * For a typeref referring to a class, the type parameters of the class. @@ -187,7 +185,7 @@ class TypeApplications(val self: Type) extends AnyVal { tp } - if (args.isEmpty || !canHaveTypeParams) self + if (args.isEmpty || ctx.erasedTypes) self else { val res = instantiate(self, self) if (isInstantiatedLambda(res)) res.select(tpnme.Apply) else res @@ -278,10 +276,8 @@ class TypeApplications(val self: Type) extends AnyVal { */ def translateParameterized(from: ClassSymbol, to: ClassSymbol)(implicit ctx: Context): Type = if (self.derivesFrom(from)) - if (canHaveTypeParams) - RefinedType(to.typeRef, to.typeParams.head.name, self.member(from.typeParams.head.name).info) - else - to.typeRef + if (ctx.erasedTypes) to.typeRef + else RefinedType(to.typeRef, to.typeParams.head.name, self.member(from.typeParams.head.name).info) else self /** If this is repeated parameter type, its underlying Seq type, |