@@ -431,9 +431,9 @@ object desugar {
431
431
lazy val creatorExpr = New (classTypeRef, constrVparamss nestedMap refOfDef)
432
432
433
433
// Methods to add to a case class C[..](p1: T1, ..., pN: Tn)(moreParams)
434
- // def _1 = this.p1
434
+ // def _1: T1 = this.p1
435
435
// ...
436
- // def _N = this.pN
436
+ // def _N: TN = this.pN
437
437
// def copy(p1: T1 = p1: @uncheckedVariance, ...,
438
438
// pN: TN = pN: @uncheckedVariance)(moreParams) =
439
439
// new C[...](p1, ..., pN)(moreParams)
@@ -442,12 +442,13 @@ object desugar {
442
442
// neg/t1843-variances.scala for a test case. The test would give
443
443
// two errors without @uncheckedVariance, one of them spurious.
444
444
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)
447
447
def productElemMeths = {
448
- val caseParams = constrVparamss .head.toArray
448
+ val caseParams = derivedVparamss .head.toArray
449
449
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))
451
452
}
452
453
def enumTagMeths = if (isEnumCase) enumTagMeth(CaseKind .Class )._1 :: Nil else Nil
453
454
def copyMeths = {
0 commit comments