@@ -119,7 +119,8 @@ object TypeErasure {
119
119
* treated. `eraseInfo` maps them them to nullary method types, whereas `erasure` maps them
120
120
* to `Function0`.
121
121
*/
122
- def eraseInfo (tp : Type )(implicit ctx : Context ): Type = scalaErasureFn.eraseInfo(tp)(erasureCtx)
122
+ def eraseInfo (tp : Type , sym : Symbol )(implicit ctx : Context ): Type =
123
+ scalaErasureFn.eraseInfo(tp, sym)(erasureCtx)
123
124
124
125
/** The erasure of a function result type. Differs from normal erasure in that
125
126
* Unit is kept instead of being mapped to BoxedUnit.
@@ -145,7 +146,7 @@ object TypeErasure {
145
146
if (defn.isPolymorphicAfterErasure(sym)) eraseParamBounds(sym.info.asInstanceOf [PolyType ])
146
147
else if (sym.isAbstractType) TypeAlias (WildcardType )
147
148
else if (sym.isConstructor) outer.addParam(sym.owner.asClass, erase(tp)(erasureCtx))
148
- else eraseInfo(tp)(erasureCtx) match {
149
+ else eraseInfo(tp, sym )(erasureCtx) match {
149
150
case einfo : MethodType if sym.isGetter && einfo.resultType.isRef(defn.UnitClass ) =>
150
151
defn.BoxedUnitClass .typeRef
151
152
case einfo =>
@@ -347,8 +348,14 @@ class TypeErasure(isJava: Boolean, isSemi: Boolean, isConstructor: Boolean, wild
347
348
else JavaArrayType (this (elemtp))
348
349
}
349
350
350
- def eraseInfo (tp : Type )(implicit ctx : Context ) = tp match {
351
- case ExprType (rt) => MethodType (Nil , Nil , eraseResult(rt))
351
+ def eraseInfo (tp : Type , sym : Symbol )(implicit ctx : Context ) = tp match {
352
+ case ExprType (rt) =>
353
+ if (sym is Param ) apply(tp)
354
+ // Note that params with ExprTypes are eliminated by ElimByName,
355
+ // but potentially re-introduced by ResolveSuper, when we add
356
+ // forwarders to mixin methods.
357
+ // See doc comment for ElimByName for speculation how we could improve this.
358
+ else MethodType (Nil , Nil , eraseResult(rt))
352
359
case tp => erasure(tp)
353
360
}
354
361
0 commit comments