@@ -105,7 +105,7 @@ object Splicer {
105
105
protected def interpretTastyContext ()(implicit env : Env ): Object =
106
106
new TastyImpl (ctx)
107
107
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 = {
109
109
val (clazz, instance) = loadModule(fn.symbol.owner)
110
110
val method = getMethod(clazz, fn.symbol.name, paramsSig(fn.symbol))
111
111
stopIfRuntimeException(method.invoke(instance, args : _* ))
@@ -225,7 +225,7 @@ object Splicer {
225
225
def interpretTypeQuote (tree : tpd.Tree )(implicit env : Env ): Boolean = true
226
226
def interpretLiteral (value : Any )(implicit env : Env ): Boolean = true
227
227
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)
229
229
230
230
def unexpectedTree (tree : tpd.Tree )(implicit env : Env ): Boolean = {
231
231
// Assuming that top-level splices can only be in inline methods
@@ -244,7 +244,7 @@ object Splicer {
244
244
protected def interpretTypeQuote (tree : Tree )(implicit env : Env ): Res
245
245
protected def interpretLiteral (value : Any )(implicit env : Env ): Res
246
246
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
248
248
protected def unexpectedTree (tree : Tree )(implicit env : Env ): Res
249
249
250
250
protected final def interpretTree (tree : Tree )(implicit env : Env ): Res = tree match {
@@ -261,18 +261,18 @@ object Splicer {
261
261
interpretTastyContext()
262
262
263
263
case StaticMethodCall (fn, args) =>
264
- val interpretedArgs = args.map(arg => interpretTree(arg))
265
- interpretStaticMethodCall(fn, interpretedArgs)
264
+ interpretStaticMethodCall(fn, args.map(arg => interpretTree(arg)))
266
265
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)`
267
268
case Block (stats, expr) =>
268
269
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))
270
272
case stat => return unexpectedTree(stat)
271
273
})
272
274
interpretTree(expr)(newEnv)
273
-
274
275
case NamedArg (_, arg) => interpretTree(arg)
275
-
276
276
case Ident (name) if env.contains(name) => env(name)
277
277
278
278
case _ => unexpectedTree(tree)
0 commit comments