aboutsummaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-02-08 21:08:49 +1100
committerMartin Odersky <odersky@gmail.com>2017-04-04 13:20:45 +0200
commit0a4891153f65315473cac4294b0427a071efa70a (patch)
tree552a477a270cbad52862a7c9e5b662a2999e2b75 /compiler
parenta71cb970b779692d2dd68cd9ba00d2be5e6759be (diff)
downloaddotty-0a4891153f65315473cac4294b0427a071efa70a.tar.gz
dotty-0a4891153f65315473cac4294b0427a071efa70a.tar.bz2
dotty-0a4891153f65315473cac4294b0427a071efa70a.zip
Fix mal-formatting.
Insert an empty line before "where" in an explanation.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Decorators.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/printing/Formatting.scala6
2 files changed, 5 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Decorators.scala b/compiler/src/dotty/tools/dotc/core/Decorators.scala
index 0e8ae196a..c65dc5b97 100644
--- a/compiler/src/dotty/tools/dotc/core/Decorators.scala
+++ b/compiler/src/dotty/tools/dotc/core/Decorators.scala
@@ -185,7 +185,7 @@ object Decorators {
* give more info about type variables and to disambiguate where needed.
*/
def ex(args: Any*)(implicit ctx: Context): String =
- explained2(implicit ctx => em(args: _*))
+ explained(implicit ctx => em(args: _*))
/** Formatter that adds syntax highlighting to all interpolated values */
def hl(args: Any*)(implicit ctx: Context): String =
diff --git a/compiler/src/dotty/tools/dotc/printing/Formatting.scala b/compiler/src/dotty/tools/dotc/printing/Formatting.scala
index 05f1af9d7..760b22689 100644
--- a/compiler/src/dotty/tools/dotc/printing/Formatting.scala
+++ b/compiler/src/dotty/tools/dotc/printing/Formatting.scala
@@ -213,9 +213,11 @@ object Formatting {
* ex"disambiguate $tpe1 and $tpe2"
* ```
*/
- def explained2(op: Context => String)(implicit ctx: Context): String = {
+ def explained(op: Context => String)(implicit ctx: Context): String = {
val seen = new Seen
- op(explainCtx(seen)) ++ explanations(seen)
+ val msg = op(explainCtx(seen))
+ val addendum = explanations(seen)
+ if (addendum.isEmpty) msg else msg ++ "\n\n" ++ addendum
}
/** When getting a type mismatch it is useful to disambiguate placeholders like: