Permalink
Browse files

Fix 4812

Remove default arguments from parameter ValDefs in UnCurry.
  • Loading branch information...
lrytz committed May 19, 2012
1 parent 5b9bf3d commit 57967c9d1e93aa3a4d26fc02f13172f4622ed9e3
Showing with 12 additions and 3 deletions.
  1. +8 −3 src/compiler/scala/tools/nsc/transform/UnCurry.scala
  2. +4 −0 test/files/pos/t4812.scala
@@ -568,7 +568,12 @@ abstract class UnCurry extends InfoTransform
if ((sym ne null) && (sym.elisionLevel.exists (_ < settings.elidebelow.value || settings.noassertions.value)))
replaceElidableTree(tree)
else translateSynchronized(tree) match {
case dd @ DefDef(mods, name, tparams, vparamss, tpt, rhs) =>
case dd @ DefDef(mods, name, tparams, _, tpt, rhs) =>
// Remove default argument trees from parameter ValDefs, SI-4812
val vparamssNoRhs = dd.vparamss mapConserve (_ mapConserve {p =>
treeCopy.ValDef(p, p.mods, p.name, p.tpt, EmptyTree)
})
if (dd.symbol hasAnnotation VarargsClass) saveRepeatedParams(dd)
withNeedLift(false) {
@@ -586,10 +591,10 @@ abstract class UnCurry extends InfoTransform
}
treeCopy.DefDef(
dd, mods, name, transformTypeDefs(tparams),
transformValDefss(vparamss), transform(tpt), rhs1)
transformValDefss(vparamssNoRhs), transform(tpt), rhs1)
}
} else {
super.transform(dd)
super.transform(treeCopy.DefDef(dd, mods, name, tparams, vparamssNoRhs, tpt, rhs))
}
}
case ValDef(_, _, _, rhs) =>
@@ -0,0 +1,4 @@
trait Test1 {
def m1(sym: Symbol = 'TestSym)
def m2(s: String = "TestString")
}

0 comments on commit 57967c9

Please sign in to comment.