@@ -68,7 +68,7 @@ object Splicer {
6868 def checkValidStat (tree : Tree ): Unit = tree match {
6969 case tree : ValDef if tree.symbol.is(Synthetic ) =>
7070 // Check val from `foo(j = x, i = y)` which it is expanded to
71- // `val j$1 = x; val i$1 = y; foo(i = y , j = x )`
71+ // `val j$1 = x; val i$1 = y; foo(i = i$1 , j = j$1 )`
7272 checkIfValidArgument(tree.rhs)
7373 case _ =>
7474 ctx.error(" Macro should not have statements" , tree.sourcePos)
@@ -119,12 +119,15 @@ object Splicer {
119119 stats.foreach(checkValidStat)
120120 checkIfValidStaticCall(expr)
121121
122- case Typed (expr, _) => checkIfValidStaticCall(expr)
122+ case Typed (expr, _) =>
123+ checkIfValidStaticCall(expr)
124+
123125 case Call (fn, args)
124126 if (fn.symbol.isConstructor && fn.symbol.owner.owner.is(Package )) ||
125127 fn.symbol.is(Module ) || fn.symbol.isStatic ||
126128 (fn.qualifier.symbol.is(Module ) && fn.qualifier.symbol.isStatic) =>
127129 args.flatten.foreach(checkIfValidArgument)
130+
128131 case _ =>
129132 ctx.error(
130133 """ Malformed macro.
@@ -201,7 +204,7 @@ object Splicer {
201204 }
202205
203206 // Interpret `foo(j = x, i = y)` which it is expanded to
204- // `val j$1 = x; val i$1 = y; foo(i = y , j = x )`
207+ // `val j$1 = x; val i$1 = y; foo(i = i$1 , j = j$1 )`
205208 case Block (stats, expr) => interpretBlock(stats, expr)
206209 case NamedArg (_, arg) => interpretTree(arg)
207210
@@ -404,6 +407,9 @@ object Splicer {
404407 }
405408
406409 object Call {
410+ /** Matches an expression that is either a field access or an application
411+ * It retruns a TermRef containing field accessed or a method reference and the arguments passed to it.
412+ */
407413 def unapply (arg : Tree )(implicit ctx : Context ): Option [(RefTree , List [List [Tree ]])] =
408414 Call0 .unapply(arg).map((fn, args) => (fn, args.reverse))
409415
0 commit comments