@@ -361,15 +361,26 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
361
361
case block : Block =>
362
362
blockToText(block)
363
363
case If (cond, thenp, elsep) =>
364
+ val isInline = tree.isInstanceOf [Trees .InlineIf [_]]
364
365
changePrec(GlobalPrec ) {
365
- keywordStr(" if " ) ~ toText(cond) ~ (keywordText(" then" ) provided ! cond.isInstanceOf [Parens ]) ~~ toText(thenp) ~ optText(elsep)(keywordStr(" else " ) ~ _)
366
+ keywordStr(if (isInline) " inline if " else " if " ) ~
367
+ toText(cond) ~ (keywordText(" then" ) provided ! cond.isInstanceOf [Parens ]) ~~
368
+ toText(thenp) ~ optText(elsep)(keywordStr(" else " ) ~ _)
366
369
}
367
370
case Closure (env, ref, target) =>
368
371
" closure(" ~ (toTextGlobal(env, " , " ) ~ " | " provided env.nonEmpty) ~
369
372
toTextGlobal(ref) ~ (" :" ~ toText(target) provided ! target.isEmpty) ~ " )"
370
373
case Match (sel, cases) =>
371
- if (sel.isEmpty) blockText(cases)
372
- else changePrec(GlobalPrec ) { toText(sel) ~ keywordStr(" match " ) ~ blockText(cases) }
374
+ val isInline = tree.isInstanceOf [Trees .InlineMatch [_]]
375
+ if (sel.isEmpty && ! isInline) blockText(cases)
376
+ else changePrec(GlobalPrec ) {
377
+ val selTxt : Text =
378
+ if (isInline)
379
+ if (sel.isEmpty) keywordStr(" implicit" )
380
+ else keywordStr(" inline " ) ~ toText(sel)
381
+ else toText(sel)
382
+ selTxt ~ keywordStr(" match " ) ~ blockText(cases)
383
+ }
373
384
case CaseDef (pat, guard, body) =>
374
385
keywordStr(" case " ) ~ inPattern(toText(pat)) ~ optText(guard)(keywordStr(" if " ) ~ _) ~ " => " ~ caseBlockText(body)
375
386
case Labeled (bind, expr) =>
0 commit comments