aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala
diff options
context:
space:
mode:
authorEnno Runne <enno@runne.net>2017-03-05 22:26:59 +0100
committerEnno Runne <enno@runne.net>2017-03-05 22:26:59 +0100
commitc3ec6dfbdeadb2fc9e7ac191b4c1a4d6838e8a5b (patch)
treec1f544d278ed0da4be19fba83d2da3f3b66be7cd /compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala
parent34e3508cccbbcc49554a4c5b13419769cc3c7bf9 (diff)
downloaddotty-c3ec6dfbdeadb2fc9e7ac191b4c1a4d6838e8a5b.tar.gz
dotty-c3ec6dfbdeadb2fc9e7ac191b4c1a4d6838e8a5b.tar.bz2
dotty-c3ec6dfbdeadb2fc9e7ac191b4c1a4d6838e8a5b.zip
More detail in error messages
Split error messages for recursive method and overloaded method needs type into two (but did not solve the analysis which to show). Make CyclicReference type error construct corresponding error message.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala b/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala
index f23b85c58..3a377bdc0 100644
--- a/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala
+++ b/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala
@@ -28,11 +28,14 @@ object ErrorReporting {
def cyclicErrorMsg(ex: CyclicReference)(implicit ctx: Context) = {
val cycleSym = ex.denot.symbol
- def errorMsg(msg: String, cx: Context): Message =
+ def errorMsg(msg: Message, cx: Context): Message =
if (cx.mode is Mode.InferringReturnType) {
cx.tree match {
case tree: untpd.DefDef if !tree.tpt.typeOpt.exists =>
- OverloadedOrRecursiveMethodNeedsResultType(tree.name)
+ // TODO: analysis if tree is an overloaded method (or directly recursive)
+ val overloaded = true
+ if (overloaded) OverloadedMethodNeedsResultType(tree.name)
+ else RecursiveMethodNeedsResultType(tree.name)
case tree: untpd.ValDef if !tree.tpt.typeOpt.exists =>
RecursiveValueNeedsResultType(tree.name)
case _ =>
@@ -43,7 +46,7 @@ object ErrorReporting {
if (cycleSym.is(Implicit, butNot = Method) && cycleSym.owner.isTerm)
CyclicReferenceInvolvingImplicit(cycleSym)
else
- errorMsg(ex.show, ctx)
+ errorMsg(ex.toMessage, ctx)
}
def wrongNumberOfTypeArgs(fntpe: Type, expectedArgs: List[TypeParamInfo], actual: List[untpd.Tree], pos: Position)(implicit ctx: Context) =