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