Skip to content

Commit 2db2df4

Browse files
committed
Keep old scheme under Scala-2 mode
1 parent cb5c76e commit 2db2df4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,8 @@ object desugar {
430430
// new C[Ts](paramss)
431431
lazy val creatorExpr = New(classTypeRef, constrVparamss nestedMap refOfDef)
432432

433+
val copiedAccessFlags = if (ctx.scala2Mode) EmptyFlags else AccessFlags
434+
433435
// Methods to add to a case class C[..](p1: T1, ..., pN: Tn)(moreParams)
434436
// def _1: T1 = this.p1
435437
// ...
@@ -469,7 +471,7 @@ object desugar {
469471
val copyRestParamss = derivedVparamss.tail.nestedMap(vparam =>
470472
cpy.ValDef(vparam)(rhs = EmptyTree))
471473
DefDef(nme.copy, derivedTparams, copyFirstParams :: copyRestParamss, TypeTree(), creatorExpr)
472-
.withFlags(Synthetic | constr1.mods.flags & AccessFlags) :: Nil
474+
.withFlags(Synthetic | constr1.mods.flags & copiedAccessFlags) :: Nil
473475
}
474476
}
475477

@@ -574,7 +576,7 @@ object desugar {
574576
if (mods is Abstract) Nil
575577
else
576578
DefDef(nme.apply, derivedTparams, derivedVparamss, applyResultTpt, widenedCreatorExpr)
577-
.withFlags(Synthetic | constr1.mods.flags & (DefaultParameterized | AccessFlags)) :: widenDefs
579+
.withFlags(Synthetic | constr1.mods.flags & (DefaultParameterized | copiedAccessFlags)) :: widenDefs
578580
val unapplyMeth = {
579581
val unapplyParam = makeSyntheticParameter(tpt = classTypeRef)
580582
val unapplyRHS = if (arity == 0) Literal(Constant(true)) else Ident(unapplyParam.name)
@@ -658,8 +660,6 @@ object desugar {
658660
flatTree(cdef1 :: companions ::: implicitWrappers)
659661
}
660662

661-
val AccessOrSynthetic: FlagSet = AccessFlags | Synthetic
662-
663663
/** Expand
664664
*
665665
* object name extends parents { self => body }

0 commit comments

Comments
 (0)