From 7561db09c19bff7871cfd96c327f6f7882480ebd Mon Sep 17 00:00:00 2001 From: Felix Mulder Date: Tue, 27 Sep 2016 17:27:59 +0200 Subject: Fix TypeMismatch not getting nonsensical tags in some cases Thanks @smarter! --- src/dotty/tools/dotc/typer/ErrorReporting.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/dotty/tools/dotc/typer/ErrorReporting.scala') diff --git a/src/dotty/tools/dotc/typer/ErrorReporting.scala b/src/dotty/tools/dotc/typer/ErrorReporting.scala index 1fd4fc96e..1d22dc646 100644 --- a/src/dotty/tools/dotc/typer/ErrorReporting.scala +++ b/src/dotty/tools/dotc/typer/ErrorReporting.scala @@ -102,7 +102,7 @@ object ErrorReporting { def patternConstrStr(tree: Tree): String = ??? def typeMismatch(tree: Tree, pt: Type, implicitFailure: SearchFailure = NoImplicitMatches): Tree = - errorTree(tree, typeMismatchMsg(normalize(tree.tpe, pt), pt) /*+ implicitFailure.postscript*/) + errorTree(tree, typeMismatchMsg(normalize(tree.tpe, pt), pt, implicitFailure.postscript)) /** A subtype log explaining why `found` does not conform to `expected` */ def whyNoMatchStr(found: Type, expected: Type) = @@ -111,7 +111,7 @@ object ErrorReporting { else "" - def typeMismatchMsg(found: Type, expected: Type) = { + def typeMismatchMsg(found: Type, expected: Type, postScript: String = "") = { // replace constrained polyparams and their typevars by their bounds where possible object reported extends TypeMap { def setVariance(v: Int) = variance = v @@ -133,7 +133,7 @@ object ErrorReporting { val found1 = reported(found) reported.setVariance(-1) val expected1 = reported(expected) - TypeMismatch(found1, expected1, whyNoMatchStr(found, expected)) + TypeMismatch(found1, expected1, whyNoMatchStr(found, expected), postScript) } /** Format `raw` implicitNotFound argument, replacing all -- cgit v1.2.3