Skip to content

Commit 568c8fa

Browse files
committed
Fix scala#569 - newRefArray
newRefArray needs to be treated specially at and after erasure because it is the only source-defined method that's still polymoprhic.
1 parent d3d13f6 commit 568c8fa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,11 @@ object Erasure extends TypeTestsCasts{
469469
tpt = untpd.TypedSplice(TypeTree(sym.info).withPos(vdef.tpt.pos))), sym)
470470

471471
override def typedDefDef(ddef: untpd.DefDef, sym: Symbol)(implicit ctx: Context) = {
472-
val restpe = sym.info.resultType
472+
val restpe =
473+
if (sym == defn.newRefArrayMethod) defn.ObjectType
474+
// newRefArray is the only source defined method that's polymorphic
475+
// after erasure; needs to be treated specially
476+
else sym.info.resultType
473477
val ddef1 = untpd.cpy.DefDef(ddef)(
474478
tparams = Nil,
475479
vparamss = (outer.paramDefs(sym) ::: ddef.vparamss.flatten) :: Nil,
@@ -600,7 +604,7 @@ object Erasure extends TypeTestsCasts{
600604

601605
traverse(newStats, oldStats)
602606
}
603-
607+
604608
private final val NoBridgeFlags = Flags.Accessor | Flags.Deferred | Flags.Lazy
605609

606610
/** Create a bridge DefDef which overrides a parent method.

0 commit comments

Comments
 (0)