Skip to content

Commit 8849730

Browse files
committed
Improve output of -Xprint-inline
1 parent c5181b9 commit 8849730

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,10 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
523523
case SeqLiteral(elems, elemtpt) =>
524524
"[" ~ toTextGlobal(elems, ",") ~ " : " ~ toText(elemtpt) ~ "]"
525525
case tree @ Inlined(call, bindings, body) =>
526-
(("/* inlined from " ~ (if (call.isEmpty) "outside" else toText(call)) ~ " */ ") `provided`
527-
!homogenizedView && ctx.settings.XprintInline.value) ~
528-
(if bindings.isEmpty then toText(body) else blockText(bindings :+ body))
526+
val bodyText = if bindings.isEmpty then toText(body) else blockText(bindings :+ body)
527+
if homogenizedView || !ctx.settings.XprintInline.value then bodyText
528+
else if call.isEmpty then stringText("{{") ~ stringText("/* inlined from outside */") ~ bodyText ~ stringText("}}")
529+
else keywordText("{{") ~ keywordText("/* inlined from ") ~ toText(call) ~ keywordText(" */") ~ bodyText ~ keywordText("}}")
529530
case tpt: untpd.DerivedTypeTree =>
530531
"<derived typetree watching " ~ tpt.watched.showSummary() ~ ">"
531532
case TypeTree() =>

0 commit comments

Comments
 (0)