Skip to content

Commit 086f33d

Browse files
committed
Allow to suppress "inlined from" parts when printing trees
-Yshow-no-inline suppresses "inlined from" parts when printing trees. This is useful when one has deeply inlined structures, as is the case when looking at `trace`ed code.
1 parent 0ff0189 commit 086f33d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class ScalaSettings extends Settings.SettingGroup {
8787
val YdisableFlatCpCaching = BooleanSetting("-YdisableFlatCpCaching", "Do not cache flat classpath representation of classpath elements from jars across compiler instances.")
8888

8989
val YnoImports = BooleanSetting("-Yno-imports", "Compile without importing scala.*, java.lang.*, or Predef.")
90+
val YnoInline = BooleanSetting("-Yno-inline", "Suppress inlining.")
9091
val YnoGenericSig = BooleanSetting("-Yno-generic-signatures", "Suppress generation of generic signatures for Java.")
9192
val YnoPredef = BooleanSetting("-Yno-predef", "Compile without importing Predef.")
9293
val Yskip = PhasesSetting("-Yskip", "Skip")
@@ -126,7 +127,7 @@ class ScalaSettings extends Settings.SettingGroup {
126127
val YexplainLowlevel = BooleanSetting("-Yexplain-lowlevel", "When explaining type errors, show types at a lower level.")
127128
val YnoDoubleBindings = BooleanSetting("-Yno-double-bindings", "Assert no namedtype is bound twice (should be enabled only if program is error-free).")
128129
val YshowVarBounds = BooleanSetting("-Yshow-var-bounds", "Print type variables with their bounds")
129-
val YnoInline = BooleanSetting("-Yno-inline", "Suppress inlining.")
130+
val YshowNoInline = BooleanSetting("-Yshow-no-inline", "Show inlined code without the 'inlined from' info")
130131

131132
/** Linker specific flags */
132133
val optimise = BooleanSetting("-optimise", "Generates faster bytecode by applying local optimisations to the .program") withAbbreviation "-optimize"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
359359
case SeqLiteral(elems, elemtpt) =>
360360
"[" ~ toTextGlobal(elems, ",") ~ " : " ~ toText(elemtpt) ~ "]"
361361
case tree @ Inlined(call, bindings, body) =>
362-
(("/* inlined from " ~ toText(call) ~ "*/ ") provided !homogenizedView) ~
362+
(("/* inlined from " ~ toText(call) ~ "*/ ") provided !homogenizedView && !ctx.settings.YshowNoInline.value) ~
363363
blockText(bindings :+ body)
364364
case tpt: untpd.DerivedTypeTree =>
365365
"<derived typetree watching " ~ summarized(toText(tpt.watched)) ~ ">"

0 commit comments

Comments
 (0)