Skip to content

Commit d875710

Browse files
committed
Make ensureMethodic work after erasure.
Previously it didn't, because it created an ExprType, which is illegal after erasure.
1 parent 051b264 commit d875710

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/dotty/tools/dotc/core/TypeErasure.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ object TypeErasure {
164164
else if (sym.isConstructor) outer.addParam(sym.owner.asClass, erase(tp)(erasureCtx))
165165
else erase.eraseInfo(tp, sym)(erasureCtx) match {
166166
case einfo: MethodType if sym.isGetter && einfo.resultType.isRef(defn.UnitClass) =>
167-
MethodType(Nil, Nil, defn.BoxedUnitClass.typeRef)
167+
MethodType(Nil, defn.BoxedUnitClass.typeRef)
168168
case einfo =>
169169
einfo
170170
}

src/dotty/tools/dotc/transform/TypeUtils.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ class TypeUtils(val self: Type) extends AnyVal {
2929

3030
def ensureMethodic(implicit ctx: Context): Type = self match {
3131
case self: MethodicType => self
32-
case _ => ExprType(self)
32+
case _ => if (ctx.erasedTypes) MethodType(Nil, self) else ExprType(self)
3333
}
3434
}

0 commit comments

Comments
 (0)