@@ -540,35 +540,37 @@ object Erasure {
540540 * with more than `MaxImplementedFunctionArity` parameters to ise a single
541541 * parameter of type `[]Object`.
542542 */
543- override def typedDefDef (ddef : untpd.DefDef , sym : Symbol )(implicit ctx : Context ) = {
544- val restpe =
545- if (sym.isConstructor) defn.UnitType
546- else sym.info.resultType
547- var vparamss1 = (outer.paramDefs(sym) ::: ddef.vparamss.flatten) :: Nil
548- var rhs1 = ddef.rhs match {
549- case id @ Ident (nme.WILDCARD ) => untpd.TypedSplice (id.withType(restpe))
550- case _ => ddef.rhs
551- }
552- if (sym.isAnonymousFunction && vparamss1.head.length > MaxImplementedFunctionArity ) {
553- val bunchedParam = ctx.newSymbol(sym, nme.ALLARGS , Flags .TermParam , JavaArrayType (defn.ObjectType ))
554- def selector (n : Int ) = ref(bunchedParam)
555- .select(defn.Array_apply )
556- .appliedTo(Literal (Constant (n)))
557- val paramDefs = vparamss1.head.zipWithIndex.map {
558- case (paramDef, idx) =>
559- assignType(untpd.cpy.ValDef (paramDef)(rhs = selector(idx)), paramDef.symbol)
543+ override def typedDefDef (ddef : untpd.DefDef , sym : Symbol )(implicit ctx : Context ) =
544+ if (sym.isType) EmptyTree
545+ else {
546+ val restpe =
547+ if (sym.isConstructor) defn.UnitType
548+ else sym.info.resultType
549+ var vparamss1 = (outer.paramDefs(sym) ::: ddef.vparamss.flatten) :: Nil
550+ var rhs1 = ddef.rhs match {
551+ case id @ Ident (nme.WILDCARD ) => untpd.TypedSplice (id.withType(restpe))
552+ case _ => ddef.rhs
560553 }
561- vparamss1 = (tpd.ValDef (bunchedParam) :: Nil ) :: Nil
562- rhs1 = untpd.Block (paramDefs, rhs1)
554+ if (sym.isAnonymousFunction && vparamss1.head.length > MaxImplementedFunctionArity ) {
555+ val bunchedParam = ctx.newSymbol(sym, nme.ALLARGS , Flags .TermParam , JavaArrayType (defn.ObjectType ))
556+ def selector (n : Int ) = ref(bunchedParam)
557+ .select(defn.Array_apply )
558+ .appliedTo(Literal (Constant (n)))
559+ val paramDefs = vparamss1.head.zipWithIndex.map {
560+ case (paramDef, idx) =>
561+ assignType(untpd.cpy.ValDef (paramDef)(rhs = selector(idx)), paramDef.symbol)
562+ }
563+ vparamss1 = (tpd.ValDef (bunchedParam) :: Nil ) :: Nil
564+ rhs1 = untpd.Block (paramDefs, rhs1)
565+ }
566+ vparamss1 = vparamss1.mapConserve(_.filterConserve(! _.symbol.is(Flags .Erased )))
567+ val ddef1 = untpd.cpy.DefDef (ddef)(
568+ tparams = Nil ,
569+ vparamss = vparamss1,
570+ tpt = untpd.TypedSplice (TypeTree (restpe).withPos(ddef.tpt.pos)),
571+ rhs = rhs1)
572+ super .typedDefDef(ddef1, sym)
563573 }
564- vparamss1 = vparamss1.mapConserve(_.filterConserve(! _.symbol.is(Flags .Erased )))
565- val ddef1 = untpd.cpy.DefDef (ddef)(
566- tparams = Nil ,
567- vparamss = vparamss1,
568- tpt = untpd.TypedSplice (TypeTree (restpe).withPos(ddef.tpt.pos)),
569- rhs = rhs1)
570- super .typedDefDef(ddef1, sym)
571- }
572574
573575 override def typedClosure (tree : untpd.Closure , pt : Type )(implicit ctx : Context ) = {
574576 val xxl = defn.isXXLFunctionClass(tree.typeOpt.typeSymbol)
0 commit comments