aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/ErrorReporting.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/typer/ErrorReporting.scala')
-rw-r--r--src/dotty/tools/dotc/typer/ErrorReporting.scala13
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: