@@ -527,12 +527,6 @@ object desugar {
527
527
// a reference to the class type bound by `cdef`, with type parameters coming from the constructor
528
528
val classTypeRef = appliedRef(classTycon)
529
529
530
- def applyResultTpt =
531
- if isEnumCase then
532
- classTypeRef
533
- else
534
- TypeTree ()
535
-
536
530
// a reference to `enumClass`, with type parameters coming from the case constructor
537
531
lazy val enumClassTypeRef =
538
532
if (enumClass.typeParams.isEmpty)
@@ -611,7 +605,7 @@ object desugar {
611
605
cpy.ValDef (vparam)(rhs = copyDefault(vparam)))
612
606
val copyRestParamss = derivedVparamss.tail.nestedMap(vparam =>
613
607
cpy.ValDef (vparam)(rhs = EmptyTree ))
614
- DefDef (nme.copy, derivedTparams, copyFirstParams :: copyRestParamss, applyResultTpt , creatorExpr)
608
+ DefDef (nme.copy, derivedTparams, copyFirstParams :: copyRestParamss, classTypeRef , creatorExpr)
615
609
.withMods(Modifiers (Synthetic | constr1.mods.flags & copiedAccessFlags, constr1.mods.privateWithin)) :: Nil
616
610
}
617
611
}
@@ -704,7 +698,7 @@ object desugar {
704
698
val appParamss =
705
699
derivedVparamss.nestedZipWithConserve(constrVparamss)((ap, cp) =>
706
700
ap.withMods(ap.mods | (cp.mods.flags & HasDefault )))
707
- DefDef (nme.apply, derivedTparams, appParamss, applyResultTpt , creatorExpr)
701
+ DefDef (nme.apply, derivedTparams, appParamss, classTypeRef , creatorExpr)
708
702
.withMods(appMods) :: Nil
709
703
}
710
704
val unapplyMeth = {
@@ -714,7 +708,7 @@ object desugar {
714
708
val methName = if (hasRepeatedParam) nme.unapplySeq else nme.unapply
715
709
val unapplyParam = makeSyntheticParameter(tpt = classTypeRef)
716
710
val unapplyRHS = if (arity == 0 ) Literal (Constant (true )) else Ident (unapplyParam.name)
717
- val unapplyResTp = if ( arity == 0 ) Literal (Constant (true )) else applyResultTpt
711
+ val unapplyResTp = if arity == 0 then Literal (Constant (true )) else classTypeRef
718
712
DefDef (methName, derivedTparams, (unapplyParam :: Nil ) :: Nil , unapplyResTp, unapplyRHS)
719
713
.withMods(synthetic)
720
714
}
0 commit comments