aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeErasure.scala
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2016-10-13 01:49:08 +0200
committerGitHub <noreply@github.com>2016-10-13 01:49:08 +0200
commit1c62d0557417612fb90108fd6a3728d7c510f968 (patch)
treef354c07cba6a589474d4a9a6a528ec21e32702b9 /src/dotty/tools/dotc/core/TypeErasure.scala
parentf738201973f6965b861fe4b0b580c2dfed61f158 (diff)
parent9e74d72d3638f70285aff88c53bab6cc57223d16 (diff)
downloaddotty-1c62d0557417612fb90108fd6a3728d7c510f968.tar.gz
dotty-1c62d0557417612fb90108fd6a3728d7c510f968.tar.bz2
dotty-1c62d0557417612fb90108fd6a3728d7c510f968.zip
Merge pull request #1560 from dotty-staging/change-one-polytype
Harmonize PolyType and TypeLambda
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeErasure.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeErasure.scala20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/dotty/tools/dotc/core/TypeErasure.scala b/src/dotty/tools/dotc/core/TypeErasure.scala
index 1a7342a12..fd5fcb921 100644
--- a/src/dotty/tools/dotc/core/TypeErasure.scala
+++ b/src/dotty/tools/dotc/core/TypeErasure.scala
@@ -356,8 +356,6 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
SuperType(this(thistpe), this(supertpe))
case ExprType(rt) =>
defn.FunctionClass(0).typeRef
- case tp: TypeProxy =>
- this(tp.underlying)
case AndType(tp1, tp2) =>
erasedGlb(this(tp1), this(tp2), isJava)
case OrType(tp1, tp2) =>
@@ -372,11 +370,6 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
case rt =>
tp.derivedMethodType(tp.paramNames, formals, rt)
}
- case tp: PolyType =>
- this(tp.resultType) match {
- case rt: MethodType => rt
- case rt => MethodType(Nil, Nil, rt)
- }
case tp @ ClassInfo(pre, cls, classParents, decls, _) =>
if (cls is Package) tp
else {
@@ -398,6 +391,8 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
tp
case tp: WildcardType if wildcardOK =>
tp
+ case tp: TypeProxy =>
+ this(tp.underlying)
}
private def eraseArray(tp: RefinedType)(implicit ctx: Context) = {
@@ -409,9 +404,9 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
else JavaArrayType(arrayErasure(elemtp))
}
- /** The erasure of a symbol's info. This is different from `apply` in the way `ExprType`s are
- * treated. `eraseInfo` maps them them to nullary method types, whereas `apply` maps them
- * to `Function0`.
+ /** The erasure of a symbol's info. This is different from `apply` in the way `ExprType`s and
+ * `PolyType`s are treated. `eraseInfo` maps them them to method types, whereas `apply` maps them
+ * to the underlying type.
*/
def eraseInfo(tp: Type, sym: Symbol)(implicit ctx: Context) = tp match {
case ExprType(rt) =>
@@ -421,6 +416,11 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
// forwarders to mixin methods.
// See doc comment for ElimByName for speculation how we could improve this.
else MethodType(Nil, Nil, eraseResult(rt))
+ case tp: PolyType =>
+ this(tp.resultType) match {
+ case rt: MethodType => rt
+ case rt => MethodType(Nil, Nil, rt)
+ }
case tp => this(tp)
}