@@ -421,8 +421,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
421
421
keywordStr(" if " ) ~ toText(cond) ~ (keywordText(" then" ) provided ! cond.isInstanceOf [Parens ]) ~~ toText(thenp) ~ optText(elsep)(keywordStr(" else " ) ~ _)
422
422
}
423
423
case Closure (env, ref, target) =>
424
- " closure(" ~ (toTextGlobal(env, " , " ) ~ " | " provided env.nonEmpty) ~
425
- toTextGlobal(ref) ~ (" :" ~ toText(target) provided ! target.isEmpty) ~ " )"
424
+ ( " closure(" ~ (toTextGlobal(env, " , " ) ~ " | " provided env.nonEmpty) ~
425
+ toTextGlobal(ref) ~ (" :" ~ toText(target) provided ! target.isEmpty) ~ " )" ).provided( ! ctx.settings. XprintUser .value)
426
426
case Match (sel, cases) =>
427
427
if (sel.isEmpty) blockText(cases)
428
428
else changePrec(GlobalPrec ) { toText(sel) ~ keywordStr(" match " ) ~ blockText(cases) }
@@ -486,10 +486,11 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
486
486
}
487
487
case tree @ DefDef (name, tparams, vparamss, tpt, _) =>
488
488
dclTextOr {
489
- val prefix = modText(tree.mods, keywordStr(" def" )) ~~ valDefText(nameIdText(tree))
489
+ val printLambda = tree.symbol.isAnonymousFunction && ctx.settings.XprintUser .value
490
+ val prefix = modText(tree.mods, keywordStr(" def" )) ~~ valDefText(nameIdText(tree)) provided (! printLambda)
490
491
withEnclosingDef(tree) {
491
- addVparamssText(prefix ~ tparamsText(tparams), vparamss) ~ optAscription(tpt) ~
492
- optText(tree.rhs)(" = " ~ _)
492
+ addVparamssText(prefix ~ tparamsText(tparams), vparamss) ~ optAscription(tpt).provided( ! printLambda) ~
493
+ optText(tree.rhs)(( if (printLambda) " => " else " = " ) ~ _)
493
494
}
494
495
}
495
496
case tree @ TypeDef (name, rhs) =>
0 commit comments