@@ -110,15 +110,20 @@ object TypeErasure {
110
110
private def erasureCtx (implicit ctx : Context ) =
111
111
if (ctx.erasedTypes) ctx.withPhase(ctx.erasurePhase).addMode(Mode .FutureDefsOK ) else ctx
112
112
113
- /** The standard erasure of a Scala type.
113
+ /** The standard erasure of a Scala type. Value classes are erased as normal classes.
114
+ *
115
+ * @param tp The type to erase.
116
+ */
117
+ def erasure (tp : Type )(implicit ctx : Context ): Type =
118
+ erasureFn(isJava = false , semiEraseVCs = false , isConstructor = false , wildcardOK = false )(tp)(erasureCtx)
119
+
120
+ /** The value class erasure of a Scala type, where value classes are semi-erased to
121
+ * ErasedValueType (they will be fully erased in [[ElimErasedValueType ]]).
114
122
*
115
123
* @param tp The type to erase.
116
- * @param semiEraseVCs If true, value classes are semi-erased to ErasedValueType
117
- * (they will be fully erased in [[ElimErasedValueType ]]).
118
- * If false, they are erased like normal classes.
119
124
*/
120
- def erasure (tp : Type , semiEraseVCs : Boolean = false )(implicit ctx : Context ): Type =
121
- erasureFn(isJava = false , semiEraseVCs, isConstructor = false , wildcardOK = false )(tp)(erasureCtx)
125
+ def valueErasure (tp : Type )(implicit ctx : Context ): Type =
126
+ erasureFn(isJava = false , semiEraseVCs = true , isConstructor = false , wildcardOK = false )(tp)(erasureCtx)
122
127
123
128
def sigName (tp : Type , isJava : Boolean )(implicit ctx : Context ): TypeName = {
124
129
val seqClass = if (isJava) defn.ArrayClass else defn.SeqClass
@@ -141,7 +146,7 @@ object TypeErasure {
141
146
case tp : ThisType =>
142
147
tp
143
148
case tp =>
144
- erasure (tp, semiEraseVCs = true )
149
+ valueErasure (tp)
145
150
}
146
151
147
152
/** 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
392
397
private def eraseDerivedValueClassRef (tref : TypeRef )(implicit ctx : Context ): Type = {
393
398
val cls = tref.symbol.asClass
394
399
val underlying = underlyingOfValueClass(cls)
395
- ErasedValueType (cls, erasure (underlying, semiEraseVCs = true ))
400
+ ErasedValueType (cls, valueErasure (underlying))
396
401
}
397
402
398
403
0 commit comments