Skip to content

Commit 59812e3

Browse files
committed
Fix layout of implicit error messages
There were extraneous whitespaces and prepositions.
1 parent 504b35b commit 59812e3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -671,13 +671,14 @@ trait Implicits { self: Typer =>
671671
|
672672
| ${arg.show.replace("\n", "\n ")}
673673
|
674-
|But $tpe.explanation}."""
674+
|But ${tpe.explanation}."""
675675
}
676676
}
677+
def location(preposition: String) = if (where.isEmpty) "" else s" $preposition $where"
677678
arg.tpe match {
678679
case ambi: AmbiguousImplicits =>
679-
msg(s"ambiguous implicit arguments: ${ambi.explanation} of $where")(
680-
s"ambiguous implicit arguments of type ${pt.show} found for $where")
680+
msg(s"ambiguous implicit arguments: ${ambi.explanation}${location("of")}")(
681+
s"ambiguous implicit arguments of type ${pt.show} found${location("for")}")
681682
case _ =>
682683
val userDefined =
683684
for {
@@ -690,7 +691,7 @@ trait Implicits { self: Typer =>
690691
pt.typeSymbol.typeParams.map(_.name.unexpandedName.toString),
691692
pt.argInfos)
692693
}
693-
msg(userDefined.getOrElse(em"no implicit argument of type $pt was found for $where"))()
694+
msg(userDefined.getOrElse(em"no implicit argument of type $pt was found${location("for")}"))()
694695
}
695696
}
696697

0 commit comments

Comments
 (0)