aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/ErrorReporting.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-08-22 14:24:49 +0200
committerMartin Odersky <odersky@gmail.com>2013-08-22 14:24:49 +0200
commit749934aeafecc65c865d92056467c08540add8cc (patch)
tree7b20ad103b0acb5b08f96c146a5a8c217a8e4b82 /src/dotty/tools/dotc/typer/ErrorReporting.scala
parentcbcdbd6fb8c0bf372a61b4ddd5b6ce181964776d (diff)
downloaddotty-749934aeafecc65c865d92056467c08540add8cc.tar.gz
dotty-749934aeafecc65c865d92056467c08540add8cc.tar.bz2
dotty-749934aeafecc65c865d92056467c08540add8cc.zip
More typer bug fixes and improvements in error messages
Diffstat (limited to 'src/dotty/tools/dotc/typer/ErrorReporting.scala')
-rw-r--r--src/dotty/tools/dotc/typer/ErrorReporting.scala16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/dotty/tools/dotc/typer/ErrorReporting.scala b/src/dotty/tools/dotc/typer/ErrorReporting.scala
index d95807e3c..177882688 100644
--- a/src/dotty/tools/dotc/typer/ErrorReporting.scala
+++ b/src/dotty/tools/dotc/typer/ErrorReporting.scala
@@ -63,16 +63,16 @@ object ErrorReporting {
def patternConstrStr(tree: Tree): String = ???
- def typeMismatch(tree: Tree, pt: Type): Tree = {
- val result = errorTree(tree,
- i"""type mismatch:
- | found : ${tree.tpe}
- | required: $pt""".stripMargin)
+ def typeMismatch(tree: Tree, pt: Type): Tree =
+ errorTree(tree, typeMismatchStr(tree.tpe, pt))
+
+ def typeMismatchStr(found: Type, expected: Type) = {
if (ctx.settings.explaintypes.value)
- new ExplainingTypeComparer().isSubType(tree.tpe, pt)
- result
+ new ExplainingTypeComparer().isSubType(found, expected)
+ i"""type mismatch:
+ | found : $found
+ | required: $expected""".stripMargin
}
-
}
def err(implicit ctx: Context): Errors = new Errors