Skip to content

Commit afacc72

Browse files
committed
Avoid double-passing of outer
1 parent fa3fc6d commit afacc72

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

compiler/src/dotty/tools/dotc/transform/Erasure.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -536,19 +536,18 @@ object Erasure {
536536

537537
/** Besides normal typing, this method does uncurrying and collects parameters
538538
* to anonymous functions of arity > 22.
539-
*
540-
*/
539+
*/
541540
override def typedApply(tree: untpd.Apply, pt: Type)(implicit ctx: Context): Tree =
542541
val Apply(fun, args) = tree
543-
if (fun.symbol == defn.cbnArg)
542+
if fun.symbol == defn.cbnArg then
544543
typedUnadapted(args.head, pt)
545544
else
546545
val origFun = fun.asInstanceOf[tpd.Tree]
547546
val origFunType = origFun.tpe.widen(using preErasureCtx)
548-
val outers = outer.args(origFun)
547+
val fun1 = typedExpr(fun, AnyFunctionProto)
548+
val outers = if fun1.isInstanceOf[Apply] then Nil else outer.args(origFun)
549549
val ownArgs = if origFunType.isErasedMethod then Nil else args
550550
val args0 = outers ::: ownArgs
551-
val fun1 = typedExpr(fun, AnyFunctionProto)
552551
fun1.tpe.widen match
553552
case mt: MethodType =>
554553
val bunchArgs = mt.paramInfos match

0 commit comments

Comments
 (0)