Skip to content

Commit a263b5f

Browse files
committed
Make sure mixin accessors are not private.
Logic moved from RefChecks to Mixin; implementation is now by name expansion instead of setting NotJavaPrivate flag.
1 parent d5df72a commit a263b5f

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/dotty/tools/dotc/transform/Mixin.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Mixin extends MiniPhaseTransform with SymTransformer { thisTransform =>
7272

7373
override def transformSym(sym: SymDenotation)(implicit ctx: Context): SymDenotation =
7474
if (sym.is(Accessor, butNot = Deferred) && sym.owner.is(Trait))
75-
sym.copySymDenotation(initFlags = sym.flags | Deferred)
75+
sym.copySymDenotation(initFlags = sym.flags | Deferred).ensureNotPrivate
7676
else
7777
sym
7878

src/dotty/tools/dotc/typer/RefChecks.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,11 +741,9 @@ class RefChecks extends MiniPhase with SymTransformer { thisTransformer =>
741741
*/
742742
override def transformSym(d: SymDenotation)(implicit ctx: Context) = {
743743
def mustBePublicInValueClass = d.isPrimaryConstructor || d.is(ParamAccessor)
744-
def mustBePublicInTrait = !d.is(Method) || d.isSetter || d.is(ParamAccessor)
745744
def mustBePublic = {
746745
val cls = d.owner
747-
(isDerivedValueClass(cls) && mustBePublicInValueClass ||
748-
cls.is(Trait) && mustBePublicInTrait)
746+
(isDerivedValueClass(cls) && mustBePublicInValueClass
749747
}
750748
if ((d is PrivateTerm) && mustBePublic) notPrivate(d) else d
751749
}

0 commit comments

Comments
 (0)