diff options
author | Martin Odersky <odersky@gmail.com> | 2013-07-25 22:16:07 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-07-25 22:22:42 +0200 |
commit | cf65e84a6da2a151286a36297c057b72545960c8 (patch) | |
tree | 55f3d8a30f5751602836d62d0b1a4ae6269b64bd /src/dotty/tools/dotc/typer/ErrorReporting.scala | |
parent | 0a86c0ae8668070f62df25c7a4ba12369f23b216 (diff) | |
download | dotty-cf65e84a6da2a151286a36297c057b72545960c8.tar.gz dotty-cf65e84a6da2a151286a36297c057b72545960c8.tar.bz2 dotty-cf65e84a6da2a151286a36297c057b72545960c8.zip |
More typer logic, in particular dealing with variants of applications
Diffstat (limited to 'src/dotty/tools/dotc/typer/ErrorReporting.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/ErrorReporting.scala | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/ErrorReporting.scala b/src/dotty/tools/dotc/typer/ErrorReporting.scala index ef6184394..e0ff8e351 100644 --- a/src/dotty/tools/dotc/typer/ErrorReporting.scala +++ b/src/dotty/tools/dotc/typer/ErrorReporting.scala @@ -13,9 +13,12 @@ object ErrorReporting { import tpd._ - def errorTree(tree: Trees.Tree[_], msg: => String)(implicit ctx: Context): tpd.Tree = { - ctx.error(msg, tree.pos) - tree withType ErrorType + def errorTree(tree: Tree, msg: => String)(implicit ctx: Context): tpd.Tree = + tree withType errorType(msg, tree.pos) + + def errorType(msg: => String, pos: Position)(implicit ctx: Context): ErrorType = { + ctx.error(msg, pos) + ErrorType } class Errors(implicit ctx: Context) { @@ -54,6 +57,10 @@ object ErrorReporting { case _ => anonymousTypeMemberStr(tp) } + def exprStr(tree: Tree): String = refStr(tree.tpe) + + def patternConstrStr(tree: Tree): String = ??? + def typeMismatch(tree: Tree, pt: Type): Tree = errorTree(tree, s"""type mismatch: |