From 36476e46815370ca282cbb3179711125444319e9 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 16 Dec 2013 16:06:56 +0100 Subject: Default arguments now have a position --- src/dotty/tools/dotc/typer/Applications.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/typer/Applications.scala') diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index dba95c689..5912e5e7b 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -78,6 +78,8 @@ trait Applications extends Compatibility { self: Typer => /** Signal failure with given message at position of the application itself */ protected def fail(msg: => String): Unit + protected def appPos: Position + /** If constructing trees, the current function part, which might be * affected by lifting. EmptyTree otherwise. */ @@ -246,7 +248,7 @@ trait Applications extends Compatibility { self: Typer => findDefaultGetter(n + numArgs(normalizedFun)) match { case dref: NamedType => liftFun() - addTyped(treeToArg(spliceMeth(Ident(dref), normalizedFun)), formal) + addTyped(treeToArg(spliceMeth(Ident(dref) withPos appPos, normalizedFun)), formal) matchArgs(args1, formals1, n + 1) case _ => missingArg(n) @@ -323,6 +325,7 @@ trait Applications extends Compatibility { self: Typer => ok = false def fail(msg: => String) = ok = false + def appPos = NoPosition def normalizedFun = EmptyTree init() } @@ -366,6 +369,8 @@ trait Applications extends Compatibility { self: Typer => typedArgBuf += seqToRepeated(seqLit) } + override def appPos = app.pos + def fail(msg: => String, arg: Trees.Tree[T]) = { ctx.error(msg, arg.pos) ok = false -- cgit v1.2.3