@@ -126,11 +126,13 @@ class Interpreter(pos: SrcPos, classLoader0: ClassLoader)(using Context):
126
126
view.toList
127
127
128
128
fnType.dealias match
129
- case fnType : MethodType if fnType.hasErasedParams => interpretArgs(argss, fnType.resType)
130
129
case fnType : MethodType =>
131
130
val argTypes = fnType.paramInfos
132
131
assert(argss.head.size == argTypes.size)
133
- interpretArgsGroup(argss.head, argTypes) ::: interpretArgs(argss.tail, fnType.resType)
132
+ val nonErasedArgs = argss.head.lazyZip(fnType.erasedParams).collect { case (arg, false ) => arg }.toList
133
+ val nonErasedArgTypes = fnType.paramInfos.lazyZip(fnType.erasedParams).collect { case (arg, false ) => arg }.toList
134
+ assert(nonErasedArgs.size == nonErasedArgTypes.size)
135
+ interpretArgsGroup(nonErasedArgs, nonErasedArgTypes) ::: interpretArgs(argss.tail, fnType.resType)
134
136
case fnType : AppliedType if defn.isContextFunctionType(fnType) =>
135
137
val argTypes :+ resType = fnType.args: @ unchecked
136
138
interpretArgsGroup(argss.head, argTypes) ::: interpretArgs(argss.tail, resType)
@@ -328,8 +330,8 @@ object Interpreter:
328
330
object Call :
329
331
import tpd ._
330
332
/** Matches an expression that is either a field access or an application
331
- * It retruns a TermRef containing field accessed or a method reference and the arguments passed to it.
332
- */
333
+ * It returns a TermRef containing field accessed or a method reference and the arguments passed to it.
334
+ */
333
335
def unapply (arg : Tree )(using Context ): Option [(RefTree , List [List [Tree ]])] =
334
336
Call0 .unapply(arg).map((fn, args) => (fn, args.reverse))
335
337
@@ -339,10 +341,8 @@ object Interpreter:
339
341
Some ((fn, args))
340
342
case fn : Ident => Some ((tpd.desugarIdent(fn).withSpan(fn.span), Nil ))
341
343
case fn : Select => Some ((fn, Nil ))
342
- case Apply (f @ Call0 (fn, args1), args2) =>
343
- if (f.tpe.widenDealias.hasErasedParams) Some ((fn, args1))
344
- else Some ((fn, args2 :: args1))
345
- case TypeApply (Call0 (fn, args), _) => Some ((fn, args))
344
+ case Apply (f @ Call0 (fn, argss), args) => Some ((fn, args :: argss))
345
+ case TypeApply (Call0 (fn, argss), _) => Some ((fn, argss))
346
346
case _ => None
347
347
}
348
348
}
0 commit comments