aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeErasure.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-06-25 22:03:01 +0200
committerMartin Odersky <odersky@gmail.com>2015-06-26 18:12:11 +0200
commit4b48243a24e533ba81149df956fdc16cdaf1460e (patch)
treeca1794cd908fa93259fa081e68f43682ed2fb4da /src/dotty/tools/dotc/core/TypeErasure.scala
parent5e6a9a28241ea8c64617bf90f9c331a352409035 (diff)
downloaddotty-4b48243a24e533ba81149df956fdc16cdaf1460e.tar.gz
dotty-4b48243a24e533ba81149df956fdc16cdaf1460e.tar.bz2
dotty-4b48243a24e533ba81149df956fdc16cdaf1460e.zip
Fix erasure of Thistypes.
Thistypes erased to the underlying class. This is wrong. When seen as part of some other type, a ThisType has to erase to the erasure of the underlying type (i.e. the erasure if the selftype of the class). unittest-collections.scala failed with a MethodNotFound error because the erasure was computed incorrectly. On the other hand, a tree with a ThisType type, should keep the type, analogous to a tree with a TermRef type.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeErasure.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeErasure.scala6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/TypeErasure.scala b/src/dotty/tools/dotc/core/TypeErasure.scala
index abe5418d4..8abab9155 100644
--- a/src/dotty/tools/dotc/core/TypeErasure.scala
+++ b/src/dotty/tools/dotc/core/TypeErasure.scala
@@ -315,12 +315,8 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
val parent = tp.parent
if (parent isRef defn.ArrayClass) eraseArray(tp)
else this(parent)
- case tp: TermRef =>
+ case _: TermRef | _: ThisType =>
this(tp.widen)
- case tp: ThisType =>
- def thisTypeErasure(tpToErase: Type) =
- erasureFn(isJava, semiEraseVCs = false, isConstructor, wildcardOK)(tpToErase)
- thisTypeErasure(tp.cls.typeRef)
case SuperType(thistpe, supertpe) =>
SuperType(this(thistpe), this(supertpe))
case ExprType(rt) =>