Skip to content

Commit 65b9918

Browse files
committed
Fix layout of implicit error messages
There were extraneous whitespaces and prepositions.
1 parent 93eaaaf commit 65b9918

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
@@ -672,13 +672,14 @@ trait Implicits { self: Typer =>
672672
|
673673
| ${arg.show.replace("\n", "\n ")}
674674
|
675-
|But $tpe.explanation}."""
675+
|But ${tpe.explanation}."""
676676
}
677677
}
678+
def location(preposition: String) = if (where.isEmpty) "" else s" $preposition $where"
678679
arg.tpe match {
679680
case ambi: AmbiguousImplicits =>
680-
msg(s"ambiguous implicit arguments: ${ambi.explanation} of $where")(
681-
s"ambiguous implicit arguments of type ${pt.show} found for $where")
681+
msg(s"ambiguous implicit arguments: ${ambi.explanation}${location("of")}")(
682+
s"ambiguous implicit arguments of type ${pt.show} found${location("for")}")
682683
case _ =>
683684
val userDefined =
684685
for {
@@ -691,7 +692,7 @@ trait Implicits { self: Typer =>
691692
pt.typeSymbol.typeParams.map(_.name.unexpandedName.toString),
692693
pt.argInfos)
693694
}
694-
msg(userDefined.getOrElse(em"no implicit argument of type $pt was found for $where"))()
695+
msg(userDefined.getOrElse(em"no implicit argument of type $pt was found${location("for")}"))()
695696
}
696697
}
697698

0 commit comments

Comments
 (0)