@@ -415,8 +415,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
415415 keywordStr(" if " ) ~ toText(cond) ~ (keywordText(" then" ) provided ! cond.isInstanceOf [Parens ]) ~~ toText(thenp) ~ optText(elsep)(keywordStr(" else " ) ~ _)
416416 }
417417 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)
420420 case Match (sel, cases) =>
421421 if (sel.isEmpty) blockText(cases)
422422 else changePrec(GlobalPrec ) { toText(sel) ~ keywordStr(" match " ) ~ blockText(cases) }
@@ -480,10 +480,11 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
480480 }
481481 case tree @ DefDef (name, tparams, vparamss, tpt, _) =>
482482 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)
484485 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 " = " ) ~ _)
487488 }
488489 }
489490 case tree @ TypeDef (name, rhs) =>
0 commit comments