@@ -105,7 +105,7 @@ object Splicer {
105105 protected def interpretTastyContext ()(implicit env : Env ): Object =
106106 new TastyImpl (ctx)
107107
108- protected def interpretStaticMethodCall (fn : Tree , args : List [Object ])(implicit env : Env ): Object = {
108+ protected def interpretStaticMethodCall (fn : Tree , args : => List [Object ])(implicit env : Env ): Object = {
109109 val (clazz, instance) = loadModule(fn.symbol.owner)
110110 val method = getMethod(clazz, fn.symbol.name, paramsSig(fn.symbol))
111111 stopIfRuntimeException(method.invoke(instance, args : _* ))
@@ -225,7 +225,7 @@ object Splicer {
225225 def interpretTypeQuote (tree : tpd.Tree )(implicit env : Env ): Boolean = true
226226 def interpretLiteral (value : Any )(implicit env : Env ): Boolean = true
227227 def interpretTastyContext ()(implicit env : Env ): Boolean = true
228- def interpretStaticMethodCall (fn : tpd.Tree , args : List [Boolean ])(implicit env : Env ): Boolean = args.forall(identity)
228+ def interpretStaticMethodCall (fn : tpd.Tree , args : => List [Boolean ])(implicit env : Env ): Boolean = args.forall(identity)
229229
230230 def unexpectedTree (tree : tpd.Tree )(implicit env : Env ): Boolean = {
231231 // Assuming that top-level splices can only be in inline methods
@@ -244,7 +244,7 @@ object Splicer {
244244 protected def interpretTypeQuote (tree : Tree )(implicit env : Env ): Res
245245 protected def interpretLiteral (value : Any )(implicit env : Env ): Res
246246 protected def interpretTastyContext ()(implicit env : Env ): Res
247- protected def interpretStaticMethodCall (fn : Tree , args : List [Res ])(implicit env : Env ): Res
247+ protected def interpretStaticMethodCall (fn : Tree , args : => List [Res ])(implicit env : Env ): Res
248248 protected def unexpectedTree (tree : Tree )(implicit env : Env ): Res
249249
250250 protected final def interpretTree (tree : Tree )(implicit env : Env ): Res = tree match {
@@ -261,18 +261,18 @@ object Splicer {
261261 interpretTastyContext()
262262
263263 case StaticMethodCall (fn, args) =>
264- val interpretedArgs = args.map(arg => interpretTree(arg))
265- interpretStaticMethodCall(fn, interpretedArgs)
264+ interpretStaticMethodCall(fn, args.map(arg => interpretTree(arg)))
266265
266+ // Interpret `foo(j = x, i = y)` which it is expanded to
267+ // `val j$1 = x; val i$1 = y; foo(i = y, j = x)`
267268 case Block (stats, expr) =>
268269 val newEnv = stats.foldLeft(env)((accEnv, stat) => stat match {
269- case stat : ValDef => accEnv.updated(stat.name, interpretTree(stat.rhs)(accEnv))
270+ case stat : ValDef if stat.symbol.is(Synthetic ) =>
271+ accEnv.updated(stat.name, interpretTree(stat.rhs)(accEnv))
270272 case stat => return unexpectedTree(stat)
271273 })
272274 interpretTree(expr)(newEnv)
273-
274275 case NamedArg (_, arg) => interpretTree(arg)
275-
276276 case Ident (name) if env.contains(name) => env(name)
277277
278278 case _ => unexpectedTree(tree)
0 commit comments