@@ -431,9 +431,9 @@ object desugar {
431431 lazy val creatorExpr = New (classTypeRef, constrVparamss nestedMap refOfDef)
432432
433433 // Methods to add to a case class C[..](p1: T1, ..., pN: Tn)(moreParams)
434- // def _1 = this.p1
434+ // def _1: T1 = this.p1
435435 // ...
436- // def _N = this.pN
436+ // def _N: TN = this.pN
437437 // def copy(p1: T1 = p1: @uncheckedVariance, ...,
438438 // pN: TN = pN: @uncheckedVariance)(moreParams) =
439439 // new C[...](p1, ..., pN)(moreParams)
@@ -442,12 +442,13 @@ object desugar {
442442 // neg/t1843-variances.scala for a test case. The test would give
443443 // two errors without @uncheckedVariance, one of them spurious.
444444 val caseClassMeths = {
445- def syntheticProperty (name : TermName , rhs : Tree ) =
446- DefDef (name, Nil , Nil , TypeTree () , rhs).withMods(synthetic)
445+ def syntheticProperty (name : TermName , tpt : Tree , rhs : Tree ) =
446+ DefDef (name, Nil , Nil , tpt , rhs).withMods(synthetic)
447447 def productElemMeths = {
448- val caseParams = constrVparamss .head.toArray
448+ val caseParams = derivedVparamss .head.toArray
449449 for (i <- 0 until arity if nme.selectorName(i) `ne` caseParams(i).name)
450- yield syntheticProperty(nme.selectorName(i), Select (This (EmptyTypeIdent ), caseParams(i).name))
450+ yield syntheticProperty(nme.selectorName(i), caseParams(i).tpt,
451+ Select (This (EmptyTypeIdent ), caseParams(i).name))
451452 }
452453 def enumTagMeths = if (isEnumCase) enumTagMeth(CaseKind .Class )._1 :: Nil else Nil
453454 def copyMeths = {
0 commit comments