@@ -119,7 +119,8 @@ object TypeErasure {
119119 * treated. `eraseInfo` maps them them to nullary method types, whereas `erasure` maps them
120120 * to `Function0`.
121121 */
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)
123124
124125 /** The erasure of a function result type. Differs from normal erasure in that
125126 * Unit is kept instead of being mapped to BoxedUnit.
@@ -145,7 +146,7 @@ object TypeErasure {
145146 if (defn.isPolymorphicAfterErasure(sym)) eraseParamBounds(sym.info.asInstanceOf [PolyType ])
146147 else if (sym.isAbstractType) TypeAlias (WildcardType )
147148 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 {
149150 case einfo : MethodType if sym.isGetter && einfo.resultType.isRef(defn.UnitClass ) =>
150151 defn.BoxedUnitClass .typeRef
151152 case einfo =>
@@ -347,8 +348,14 @@ class TypeErasure(isJava: Boolean, isSemi: Boolean, isConstructor: Boolean, wild
347348 else JavaArrayType (this (elemtp))
348349 }
349350
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))
352359 case tp => erasure(tp)
353360 }
354361
0 commit comments