aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-12-14 18:06:55 +0100
committerMartin Odersky <odersky@gmail.com>2015-12-15 17:51:23 +0100
commitad7333eb7ed2d891789f187c880d6bc64b1d9c26 (patch)
tree355de0b1792564dc5736499727a792b4c1b43b0f /src
parentc864e118e7bd04dcbd0503ab9af6729fda94ff3f (diff)
downloaddotty-ad7333eb7ed2d891789f187c880d6bc64b1d9c26.tar.gz
dotty-ad7333eb7ed2d891789f187c880d6bc64b1d9c26.tar.bz2
dotty-ad7333eb7ed2d891789f187c880d6bc64b1d9c26.zip
Print bounds of TypeVars only when option is enabled.
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/config/ScalaSettings.scala1
-rw-r--r--src/dotty/tools/dotc/printing/PlainPrinter.scala3
2 files changed, 3 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/config/ScalaSettings.scala b/src/dotty/tools/dotc/config/ScalaSettings.scala
index 62b071372..b1f6ca61a 100644
--- a/src/dotty/tools/dotc/config/ScalaSettings.scala
+++ b/src/dotty/tools/dotc/config/ScalaSettings.scala
@@ -173,6 +173,7 @@ class ScalaSettings extends Settings.SettingGroup {
val Ypatmatdebug = BooleanSetting("-Ypatmat-debug", "Trace pattern matching translation.")
val Yexplainlowlevel = BooleanSetting("-Yexplain-lowlevel", "When explaining type errors, show types at a lower level.")
val YnoDoubleBindings = BooleanSetting("-Yno-double-bindings", "Assert no namedtype is bound twice (should be enabled only if program is error-free).")
+ val YshowVarBounds = BooleanSetting("-YshowVarBounds", "Print type variables with their bounds")
val optimise = BooleanSetting("-optimise", "Generates faster bytecode by applying optimisations to the program") withAbbreviation "-optimize"
diff --git a/src/dotty/tools/dotc/printing/PlainPrinter.scala b/src/dotty/tools/dotc/printing/PlainPrinter.scala
index 9e5ab5d8c..8f9d70d4c 100644
--- a/src/dotty/tools/dotc/printing/PlainPrinter.scala
+++ b/src/dotty/tools/dotc/printing/PlainPrinter.scala
@@ -170,7 +170,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
val bounds =
if (constr.contains(tp)) constr.fullBounds(tp.origin)(ctx.addMode(Mode.Printing))
else TypeBounds.empty
- "(" ~ toText(tp.origin) ~ "?" ~ toText(bounds) ~ ")"
+ if (ctx.settings.YshowVarBounds.value) "(" ~ toText(tp.origin) ~ "?" ~ toText(bounds) ~ ")"
+ else toText(tp.origin)
}
case tp: LazyRef =>
"LazyRef(" ~ toTextGlobal(tp.ref) ~ ")"