diff options
author | odersky <odersky@gmail.com> | 2017-03-09 10:17:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-09 10:17:25 +0100 |
commit | 6abaa109e1add82f4add605a5cb3243e34b1ee33 (patch) | |
tree | 56c72da1c81572441de55056cb14d449eba980e4 /compiler/src/dotty/tools/dotc/typer | |
parent | bf9bdae2c2affd9a5f3e68a372c8ad3edd4ba29e (diff) | |
parent | 98465f930fe5d3f10401c454d6655da71243b923 (diff) | |
download | dotty-6abaa109e1add82f4add605a5cb3243e34b1ee33.tar.gz dotty-6abaa109e1add82f4add605a5cb3243e34b1ee33.tar.bz2 dotty-6abaa109e1add82f4add605a5cb3243e34b1ee33.zip |
Merge pull request #2049 from ennru/ennru_RecursiveNeedsType
Change "recursive/cyclic definitions needs type" errors to Message
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer')
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala b/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala index 0978c2c1e..a1690955f 100644 --- a/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala +++ b/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala @@ -28,24 +28,22 @@ object ErrorReporting { def cyclicErrorMsg(ex: CyclicReference)(implicit ctx: Context) = { val cycleSym = ex.denot.symbol - def errorMsg(msg: String, cx: Context): String = + 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 => - em"overloaded or recursive method ${tree.name} needs result type" + OverloadedOrRecursiveMethodNeedsResultType(tree.name) case tree: untpd.ValDef if !tree.tpt.typeOpt.exists => - em"recursive value ${tree.name} needs type" + RecursiveValueNeedsResultType(tree.name) case _ => errorMsg(msg, cx.outer) } } else msg if (cycleSym.is(Implicit, butNot = Method) && cycleSym.owner.isTerm) - em"""cyclic reference involving implicit $cycleSym - |This happens when the right hand-side of $cycleSym's definition involves an implicit search. - |To avoid the error, give $cycleSym an explicit type.""" + 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) = |