@@ -246,14 +246,6 @@ abstract class UnCurry extends InfoTransform
246
246
else typeNewFun match {
247
247
case typedNewFun @ Block (stats, expr : Function ) =>
248
248
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
- }
257
249
treeCopy.Block (typedNewFun, stats, expansion)
258
250
case x => throw new MatchError (x)
259
251
}
@@ -467,7 +459,7 @@ abstract class UnCurry extends InfoTransform
467
459
else translateSynchronized(tree) match {
468
460
case dd @ DefDef (mods, name, tparams, _, tpt, rhs) =>
469
461
// 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 =>
471
463
treeCopy.ValDef (p, p.mods, p.name, p.tpt, EmptyTree )
472
464
})
473
465
@@ -558,7 +550,7 @@ abstract class UnCurry extends InfoTransform
558
550
if (isByNameRef(tree1)) {
559
551
val tree2 = tree1 setType functionType(Nil , tree1.tpe)
560
552
return {
561
- if (noApply contains tree2) tree2
553
+ if (tree.attachments. contains[ PreserveArg . type ] || noApply.contains( tree2) ) tree2
562
554
else localTyper.typedPos(tree1.pos)(Apply (Select (tree2, nme.apply), Nil ))
563
555
}
564
556
}
0 commit comments