aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/printing/RefinedPrinter.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-10-20 14:58:57 +0200
committerMartin Odersky <odersky@gmail.com>2016-10-20 14:58:57 +0200
commit3e545d7378568bc853b7ee865dbf42fd65bafe12 (patch)
treec719652de05bc9c19f0d35cd8bd0db8ed30f5fb8 /src/dotty/tools/dotc/printing/RefinedPrinter.scala
parentbe29c982e43261873a57149371a2d75966d14802 (diff)
downloaddotty-3e545d7378568bc853b7ee865dbf42fd65bafe12.tar.gz
dotty-3e545d7378568bc853b7ee865dbf42fd65bafe12.tar.bz2
dotty-3e545d7378568bc853b7ee865dbf42fd65bafe12.zip
Maintain point for positions of definitions
This is needed to figure out where the defined name is in a definition.
Diffstat (limited to 'src/dotty/tools/dotc/printing/RefinedPrinter.scala')
-rw-r--r--src/dotty/tools/dotc/printing/RefinedPrinter.scala8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
index 31d45d42c..83b3da0b7 100644
--- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala
+++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
@@ -351,8 +351,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
case SeqLiteral(elems, elemtpt) =>
"[" ~ toTextGlobal(elems, ",") ~ " : " ~ toText(elemtpt) ~ "]"
case tree @ Inlined(call, bindings, body) =>
- if (homogenizedView) toTextCore(Inliner.dropInlined(tree.asInstanceOf[tpd.Inlined]))
- else "/* inlined from " ~ toText(call) ~ "*/ " ~ blockText(bindings :+ body)
+ (("/* inlined from " ~ toText(call) ~ "*/ ") provided !homogenizedView) ~
+ blockText(bindings :+ body)
case tpt: untpd.DerivedTypeTree =>
"<derived typetree watching " ~ summarized(toText(tpt.watched)) ~ ">"
case TypeTree() =>
@@ -526,7 +526,9 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
else if (!tree.isDef) txt = ("<" ~ txt ~ ":" ~ toText(tp) ~ ">").close
}
if (ctx.settings.Yprintpos.value && !tree.isInstanceOf[WithoutTypeOrPos[_]]) {
- val pos = if (homogenizedView) tree.pos.toSynthetic else tree.pos
+ val pos =
+ if (homogenizedView && !tree.isInstanceOf[MemberDef]) tree.pos.toSynthetic
+ else tree.pos
txt = (txt ~ "@" ~ pos.toString /*~ tree.getClass.toString*/).close
}
tree match {