@@ -361,15 +361,26 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
361361 case block : Block =>
362362 blockToText(block)
363363 case If (cond, thenp, elsep) =>
364+ val isInline = tree.isInstanceOf [Trees .InlineIf [_]]
364365 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 " ) ~ _)
366369 }
367370 case Closure (env, ref, target) =>
368371 " closure(" ~ (toTextGlobal(env, " , " ) ~ " | " provided env.nonEmpty) ~
369372 toTextGlobal(ref) ~ (" :" ~ toText(target) provided ! target.isEmpty) ~ " )"
370373 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+ }
373384 case CaseDef (pat, guard, body) =>
374385 keywordStr(" case " ) ~ inPattern(toText(pat)) ~ optText(guard)(keywordStr(" if " ) ~ _) ~ " => " ~ caseBlockText(body)
375386 case Labeled (bind, expr) =>
0 commit comments