@@ -246,14 +246,6 @@ abstract class UnCurry extends InfoTransform
246246 else typeNewFun match {
247247 case typedNewFun @ Block (stats, expr : Function ) =>
248248 val expansion = gen.expandFunction(localTyper)(expr, inConstructorFlag)
249- expansion match {
250- case Block (ClassDef (_, _, _, Template (_, _, body)) :: Nil , _) =>
251- body.last match {
252- case DefDef (_, _, _, _, _, Apply (_, args)) => noApply.addAll(args) // samDef args are pass-thru
253- case _ =>
254- }
255- case _ =>
256- }
257249 treeCopy.Block (typedNewFun, stats, expansion)
258250 case x => throw new MatchError (x)
259251 }
@@ -467,7 +459,7 @@ abstract class UnCurry extends InfoTransform
467459 else translateSynchronized(tree) match {
468460 case dd @ DefDef (mods, name, tparams, _, tpt, rhs) =>
469461 // Remove default argument trees from parameter ValDefs, scala/bug#4812
470- val vparamssNoRhs = dd.vparamss mapConserve (_ mapConserve {p =>
462+ val vparamssNoRhs = dd.vparamss. mapConserve(_. mapConserve { p =>
471463 treeCopy.ValDef (p, p.mods, p.name, p.tpt, EmptyTree )
472464 })
473465
@@ -558,7 +550,7 @@ abstract class UnCurry extends InfoTransform
558550 if (isByNameRef(tree1)) {
559551 val tree2 = tree1 setType functionType(Nil , tree1.tpe)
560552 return {
561- if (noApply contains tree2) tree2
553+ if (tree.attachments. contains[ PreserveArg . type ] || noApply.contains( tree2) ) tree2
562554 else localTyper.typedPos(tree1.pos)(Apply (Select (tree2, nme.apply), Nil ))
563555 }
564556 }
0 commit comments