aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeErasure.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-06-26 14:23:34 +0200
committerMartin Odersky <odersky@gmail.com>2015-06-26 18:12:11 +0200
commit28751a117f32fb163b54e36e20915fd6f2cc39ff (patch)
treeb88b7c77f9d275d101206b414155170bef46f973 /src/dotty/tools/dotc/core/TypeErasure.scala
parent8017c54da7b512478a78367f9b31a6b13260b311 (diff)
downloaddotty-28751a117f32fb163b54e36e20915fd6f2cc39ff.tar.gz
dotty-28751a117f32fb163b54e36e20915fd6f2cc39ff.tar.bz2
dotty-28751a117f32fb163b54e36e20915fd6f2cc39ff.zip
Get rid of semiEraseVCs boolean parameters
Replace by the pair of methods erasure/valueErasure. The boolean parameter is still kept, but only as a confuration parameter of the erasure objects.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeErasure.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeErasure.scala21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/dotty/tools/dotc/core/TypeErasure.scala b/src/dotty/tools/dotc/core/TypeErasure.scala
index 8abab9155..9b41eb982 100644
--- a/src/dotty/tools/dotc/core/TypeErasure.scala
+++ b/src/dotty/tools/dotc/core/TypeErasure.scala
@@ -110,15 +110,20 @@ object TypeErasure {
private def erasureCtx(implicit ctx: Context) =
if (ctx.erasedTypes) ctx.withPhase(ctx.erasurePhase).addMode(Mode.FutureDefsOK) else ctx
- /** The standard erasure of a Scala type.
+ /** The standard erasure of a Scala type. Value classes are erased as normal classes.
+ *
+ * @param tp The type to erase.
+ */
+ def erasure(tp: Type)(implicit ctx: Context): Type =
+ erasureFn(isJava = false, semiEraseVCs = false, isConstructor = false, wildcardOK = false)(tp)(erasureCtx)
+
+ /** The value class erasure of a Scala type, where value classes are semi-erased to
+ * ErasedValueType (they will be fully erased in [[ElimErasedValueType]]).
*
* @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 valueErasure(tp: Type)(implicit ctx: Context): Type =
+ erasureFn(isJava = false, semiEraseVCs = true, isConstructor = false, wildcardOK = false)(tp)(erasureCtx)
def sigName(tp: Type, isJava: Boolean)(implicit ctx: Context): TypeName = {
val seqClass = if (isJava) defn.ArrayClass else defn.SeqClass
@@ -141,7 +146,7 @@ object TypeErasure {
case tp: ThisType =>
tp
case tp =>
- erasure(tp, semiEraseVCs = true)
+ valueErasure(tp)
}
/** The symbol's erased info. This is the type's erasure, except for the following symbols:
@@ -392,7 +397,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, semiEraseVCs = true))
+ ErasedValueType(cls, valueErasure(underlying))
}