Skip to content

Commit f727bcd

Browse files
committed
Fix mal-formatting.
Insert an empty line before "where" in an explanation.
1 parent b77c24c commit f727bcd

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

compiler/src/dotty/tools/dotc/core/Decorators.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ object Decorators {
175175
* give more info about type variables and to disambiguate where needed.
176176
*/
177177
def ex(args: Any*)(implicit ctx: Context): String =
178-
explained2(implicit ctx => em(args: _*))
178+
explained(implicit ctx => em(args: _*))
179179

180180
/** Formatter that adds syntax highlighting to all interpolated values */
181181
def hl(args: Any*)(implicit ctx: Context): String =

compiler/src/dotty/tools/dotc/printing/Formatting.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,11 @@ object Formatting {
213213
* ex"disambiguate $tpe1 and $tpe2"
214214
* ```
215215
*/
216-
def explained2(op: Context => String)(implicit ctx: Context): String = {
216+
def explained(op: Context => String)(implicit ctx: Context): String = {
217217
val seen = new Seen
218-
op(explainCtx(seen)) ++ explanations(seen)
218+
val msg = op(explainCtx(seen))
219+
val addendum = explanations(seen)
220+
if (addendum.isEmpty) msg else msg ++ "\n\n" ++ addendum
219221
}
220222

221223
/** When getting a type mismatch it is useful to disambiguate placeholders like:

0 commit comments

Comments
 (0)