diff options
author | odersky <odersky@gmail.com> | 2015-06-26 09:50:45 +0200 |
---|---|---|
committer | odersky <odersky@gmail.com> | 2015-06-26 09:50:45 +0200 |
commit | 6dbb991ab81dccc42230ca1c3b94300051deb164 (patch) | |
tree | 337b7e997edfc882bf1bb3ef413d665edf78c256 /src/dotty/tools/dotc/core/TypeErasure.scala | |
parent | 67aef97ccac65be6390fed93e5c22cc0c0fa974d (diff) | |
parent | d4d2ada60864eb6c509aa6e5ae376d4c73a59a20 (diff) | |
download | dotty-6dbb991ab81dccc42230ca1c3b94300051deb164.tar.gz dotty-6dbb991ab81dccc42230ca1c3b94300051deb164.tar.bz2 dotty-6dbb991ab81dccc42230ca1c3b94300051deb164.zip |
Merge pull request #680 from smarter/simplify/erasure
TypeErasure#erasure: do not semi-erase types by default
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeErasure.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeErasure.scala | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/TypeErasure.scala b/src/dotty/tools/dotc/core/TypeErasure.scala index 92e32d4b1..abe5418d4 100644 --- a/src/dotty/tools/dotc/core/TypeErasure.scala +++ b/src/dotty/tools/dotc/core/TypeErasure.scala @@ -110,7 +110,14 @@ object TypeErasure { private def erasureCtx(implicit ctx: Context) = if (ctx.erasedTypes) ctx.withPhase(ctx.erasurePhase).addMode(Mode.FutureDefsOK) else ctx - def erasure(tp: Type, semiEraseVCs: Boolean = true)(implicit ctx: Context): Type = + /** The standard erasure of a Scala type. + * + * @param tp The type to erase. + * @param semiEraseVCs If true, value classes are semi-erased to ErasedValueType + * (they will be fully erased in [[ElimErasedValueType]]). + * If false, they are erased like normal classes. + */ + def erasure(tp: Type, semiEraseVCs: Boolean = false)(implicit ctx: Context): Type = erasureFn(isJava = false, semiEraseVCs, isConstructor = false, wildcardOK = false)(tp)(erasureCtx) def sigName(tp: Type, isJava: Boolean)(implicit ctx: Context): TypeName = { @@ -134,7 +141,7 @@ object TypeErasure { case tp: ThisType => tp case tp => - erasure(tp) + erasure(tp, semiEraseVCs = true) } /** The symbol's erased info. This is the type's erasure, except for the following symbols: @@ -389,7 +396,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean private def eraseDerivedValueClassRef(tref: TypeRef)(implicit ctx: Context): Type = { val cls = tref.symbol.asClass val underlying = underlyingOfValueClass(cls) - ErasedValueType(cls, erasure(underlying)) + ErasedValueType(cls, erasure(underlying, semiEraseVCs = true)) } |