Skip to content

Commit f87ea8a

Browse files
committed
Or even
1 parent 227928c commit f87ea8a

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

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

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -693,24 +693,11 @@ object desugar {
693693
// For all other classes, the parent is AnyRef.
694694
val companions =
695695
if (isCaseClass) {
696-
697-
// true if access to the apply method has to be restricted
698-
// i.e. if the case class constructor is either private or qualified private
699-
def restrictedAccess = {
700-
val mods = constr1.mods
701-
mods.is(Private) || (!mods.is(Protected) && mods.hasPrivateWithin)
702-
}
703-
704696
val applyMeths =
705697
if (mods.is(Abstract)) Nil
706698
else {
707-
val copiedFlagsMask = copiedAccessFlags & Private
708-
val appMods = {
709-
val protectedToPrivate = if constr1.mods.is(Protected) then Protected | Private else EmptyFlags
710-
val mods = Modifiers((Synthetic | constr1.mods.flags ^ protectedToPrivate) & copiedFlagsMask)
711-
if (restrictedAccess) mods.withPrivateWithin(constr1.mods.privateWithin)
712-
else mods
713-
}
699+
val appMods =
700+
Modifiers(Synthetic | constr1.mods.flags & copiedAccessFlags).withPrivateWithin(constr1.mods.privateWithin)
714701
val appParamss =
715702
derivedVparamss.nestedZipWithConserve(constrVparamss)((ap, cp) =>
716703
ap.withMods(ap.mods | (cp.mods.flags & HasDefault)))

0 commit comments

Comments
 (0)