aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/printing/RefinedPrinter.scala11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
index 184a10300..0e2eb77f2 100644
--- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala
+++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
@@ -364,9 +364,14 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
case _ =>
tree.fallbackToText(this)
}
- if (ctx.settings.printtypes.value && tree.hasType)
- if (tree.isType) txt = toText(tree.typeOpt)
- else if (!tree.isDef) txt = "<" ~ txt ~ ":" ~ toText(tree.typeOpt) ~ ">"
+ if (ctx.settings.printtypes.value && tree.hasType) {
+ val tp = tree.typeOpt match {
+ case tp: TermRef if tree.isInstanceOf[RefTree] && !tp.denot.isOverloaded => tp.underlying
+ case tp => tp
+ }
+ if (tree.isType) txt = toText(tp)
+ else if (!tree.isDef) txt = "<" ~ txt ~ ":" ~ toText(tp) ~ ">"
+ }
tree match {
case Block(_, _) | Template(_, _, _, _) => txt
case _ => txt.close