diff options
Diffstat (limited to 'src/dotty/tools/dotc')
-rw-r--r-- | src/dotty/tools/dotc/typer/ErrorReporting.scala | 3 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Implicits.scala | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/ErrorReporting.scala b/src/dotty/tools/dotc/typer/ErrorReporting.scala index 69c12e5f5..d3303628e 100644 --- a/src/dotty/tools/dotc/typer/ErrorReporting.scala +++ b/src/dotty/tools/dotc/typer/ErrorReporting.scala @@ -11,6 +11,7 @@ import util.Positions._ import reporting.Diagnostic import printing.Showable import printing.Disambiguation.disambiguated +import java.util.regex.Matcher.quoteReplacement object ErrorReporting { @@ -124,7 +125,7 @@ object ErrorReporting { def implicitNotFoundString(raw: String, paramNames: List[String], args: List[Type]): String = { def translate(name: String): Option[String] = { val idx = paramNames.indexOf(name) - if (idx >= 0) Some(args(idx).show) else None + if (idx >= 0) Some(quoteReplacement(args(idx).show)) else None } """\$\{\w*\}""".r.replaceSomeIn(raw, m => translate(m.matched.drop(2).init)) } diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala index 091bf49f9..f7823b2b3 100644 --- a/src/dotty/tools/dotc/typer/Implicits.scala +++ b/src/dotty/tools/dotc/typer/Implicits.scala @@ -477,9 +477,7 @@ trait Implicits { self: Typer => def assumedCanEqual = ltp.isError || rtp.isError || ltp <:< rtp || rtp <:< ltp if (!ctx.isAfterTyper && !assumedCanEqual) { val res = inferImplicitArg( - defn.EqType.appliedTo(ltp, rtp), - _ => ctx.error(d"Values of types $ltp and $rtp cannot be compared with == or !=", pos), - pos) + defn.EqType.appliedTo(ltp, rtp), msgFun => ctx.error(msgFun(""), pos), pos) implicits.println(i"Eq witness found: $res: ${res.tpe}") } } |