aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/config/ScalaSettings.scala1
-rw-r--r--src/dotty/tools/dotc/printing/RefinedPrinter.scala2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/config/ScalaSettings.scala b/src/dotty/tools/dotc/config/ScalaSettings.scala
index f1ca5bd6c..ef926c664 100644
--- a/src/dotty/tools/dotc/config/ScalaSettings.scala
+++ b/src/dotty/tools/dotc/config/ScalaSettings.scala
@@ -142,6 +142,7 @@ class ScalaSettings extends Settings.SettingGroup {
val noSelfCheck = BooleanSetting("-Yno-self-type-checks", "Suppress check for self-type conformance among inherited members.")
val YshowSuppressedErrors = BooleanSetting("-Yshow-suppressed-errors", "Also show follow-on errors and warnings that are normally supressed.")
val Yheartbeat = BooleanSetting("-Yheartbeat", "show heartbeat stack trace of compiler operations.")
+ val Yprintpos = BooleanSetting("-Yprintpos", "show tree positions")
def stop = stopAfter
/** Area-specific debug output.
diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
index 0e2eb77f2..a62eb5acd 100644
--- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala
+++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
@@ -372,6 +372,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
if (tree.isType) txt = toText(tp)
else if (!tree.isDef) txt = "<" ~ txt ~ ":" ~ toText(tp) ~ ">"
}
+ if (ctx.settings.Yprintpos.value && !tree.isInstanceOf[WithoutTypeOrPos[_]])
+ txt = txt ~ "@" ~ tree.pos.toString
tree match {
case Block(_, _) | Template(_, _, _, _) => txt
case _ => txt.close