@@ -415,8 +415,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
415
415
keywordStr(" if " ) ~ toText(cond) ~ (keywordText(" then" ) provided ! cond.isInstanceOf [Parens ]) ~~ toText(thenp) ~ optText(elsep)(keywordStr(" else " ) ~ _)
416
416
}
417
417
case Closure (env, ref, target) =>
418
- " closure(" ~ (toTextGlobal(env, " , " ) ~ " | " provided env.nonEmpty) ~
419
- toTextGlobal(ref) ~ (" :" ~ toText(target) provided ! target.isEmpty) ~ " )"
418
+ ( " closure(" ~ (toTextGlobal(env, " , " ) ~ " | " provided env.nonEmpty) ~
419
+ toTextGlobal(ref) ~ (" :" ~ toText(target) provided ! target.isEmpty) ~ " )" ).provided( ! ctx.settings. XprintUser .value)
420
420
case Match (sel, cases) =>
421
421
if (sel.isEmpty) blockText(cases)
422
422
else changePrec(GlobalPrec ) { toText(sel) ~ keywordStr(" match " ) ~ blockText(cases) }
@@ -480,10 +480,11 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
480
480
}
481
481
case tree @ DefDef (name, tparams, vparamss, tpt, _) =>
482
482
dclTextOr {
483
- val prefix = modText(tree.mods, keywordStr(" def" )) ~~ valDefText(nameIdText(tree))
483
+ val printLambda = tree.symbol.isAnonymousFunction && ctx.settings.XprintUser .value
484
+ val prefix = modText(tree.mods, keywordStr(" def" )) ~~ valDefText(nameIdText(tree)) provided (! printLambda)
484
485
withEnclosingDef(tree) {
485
- addVparamssText(prefix ~ tparamsText(tparams), vparamss) ~ optAscription(tpt) ~
486
- optText(tree.rhs)(" = " ~ _)
486
+ addVparamssText(prefix ~ tparamsText(tparams), vparamss) ~ optAscription(tpt).provided( ! printLambda) ~
487
+ optText(tree.rhs)(( if (printLambda) " => " else " = " ) ~ _)
487
488
}
488
489
}
489
490
case tree @ TypeDef (name, rhs) =>
0 commit comments