@@ -318,20 +318,6 @@ object Splicer {
318
318
protected def interpretNew (fn : Symbol , args : => List [Result ])(implicit env : Env ): Result
319
319
protected def unexpectedTree (tree : Tree )(implicit env : Env ): Result
320
320
321
- private final def removeErasedArguments (args : List [List [Tree ]], fnTpe : Type ): List [List [Tree ]] =
322
- fnTpe match {
323
- case tp : TermRef => removeErasedArguments(args, tp.underlying)
324
- case tp : PolyType => removeErasedArguments(args, tp.resType)
325
- case tp : ExprType => removeErasedArguments(args, tp.resType)
326
- case tp : MethodType =>
327
- val tail = removeErasedArguments(args.tail, tp.resType)
328
- if (tp.isErasedMethod) tail else args.head :: tail
329
- case tp : AppliedType if defn.isImplicitFunctionType(tp) =>
330
- val tail = removeErasedArguments(args.tail, tp.args.last)
331
- if (defn.isErasedFunctionType(tp)) tail else args.head :: tail
332
- case tp => assert(args.isEmpty, tp); Nil
333
- }
334
-
335
321
protected final def interpretTree (tree : Tree )(implicit env : Env ): Result = tree match {
336
322
case Apply (TypeApply (fn, _), quoted :: Nil ) if fn.symbol == defn.InternalQuoted_exprQuote =>
337
323
val quoted1 = quoted match {
@@ -359,11 +345,11 @@ object Splicer {
359
345
interpretModuleAccess(fn.symbol)
360
346
} else if (fn.symbol.isStatic) {
361
347
val module = fn.symbol.owner
362
- def interpretedArgs = removeErasedArguments( args, fn.tpe) .flatten.map(interpretTree)
348
+ def interpretedArgs = args.flatten.map(interpretTree)
363
349
interpretStaticMethodCall(module, fn.symbol, interpretedArgs)
364
350
} else if (fn.qualifier.symbol.is(Module ) && fn.qualifier.symbol.isStatic) {
365
351
val module = fn.qualifier.symbol.moduleClass
366
- def interpretedArgs = removeErasedArguments( args, fn.tpe) .flatten.map(interpretTree)
352
+ def interpretedArgs = args.flatten.map(interpretTree)
367
353
interpretStaticMethodCall(module, fn.symbol, interpretedArgs)
368
354
} else if (env.contains(fn.name)) {
369
355
env(fn.name)
@@ -407,12 +393,14 @@ object Splicer {
407
393
def unapply (arg : Tree ): Option [(RefTree , List [List [Tree ]])] =
408
394
Call0 .unapply(arg).map((fn, args) => (fn, args.reverse))
409
395
410
- object Call0 {
396
+ private object Call0 {
411
397
def unapply (arg : Tree ): Option [(RefTree , List [List [Tree ]])] = arg match {
412
398
case Select (Call0 (fn, args), nme.apply) if defn.isImplicitFunctionType(fn.tpe.widenDealias.finalResultType) =>
413
399
Some ((fn, args))
414
400
case fn : RefTree => Some ((fn, Nil ))
415
- case Apply (Call0 (fn, args1), args2) => Some ((fn, args2 :: args1))
401
+ case Apply (f @ Call0 (fn, args1), args2) =>
402
+ if (f.tpe.widenDealias.isErasedMethod) Some ((fn, args1))
403
+ else Some ((fn, args2 :: args1))
416
404
case TypeApply (Call0 (fn, args), _) => Some ((fn, args))
417
405
case _ => None
418
406
}
0 commit comments