From fcb3932b32a2133612473e7b061859f97aa562df Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Fri, 23 May 2014 12:26:08 +0200 Subject: macro args now correctly preserve range positions Somewhen in the 2.11.0 development cycle we started duplicating macro arguments for increased robustness. What wasn't taken into account though is that Tree.duplicate destroys range positions. This commit fixes the problem. 2.10.x is unaffected by this bug, because it doesn't duplicate the args yet. --- src/compiler/scala/tools/nsc/typechecker/Macros.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/compiler/scala/tools/nsc/typechecker/Macros.scala') diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala index f4456998c0..f40a92f8e5 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala @@ -417,9 +417,10 @@ trait Macros extends MacroRuntimes with Traces with Helpers { val wrappedArgs = mapWithIndex(args)((arg, j) => { val fingerprint = implParams(min(j, implParams.length - 1)) + val duplicatedArg = duplicateAndKeepPositions(arg) fingerprint match { - case LiftedTyped => context.Expr[Nothing](arg.duplicate)(TypeTag.Nothing) // TODO: SI-5752 - case LiftedUntyped => arg.duplicate + case LiftedTyped => context.Expr[Nothing](duplicatedArg)(TypeTag.Nothing) // TODO: SI-5752 + case LiftedUntyped => duplicatedArg case _ => abort(s"unexpected fingerprint $fingerprint in $binding with paramss being $paramss " + s"corresponding to arg $arg in $argss") } -- cgit v1.2.3