Skip to content

Commit e673804

Browse files
som-snytttgodzik
authored andcommitted
Prefer isPublic in RefChecks
[Cherry-picked ae1b583]
1 parent 9c18d25 commit e673804

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,6 @@ object RefChecks {
445445

446446
// todo: align accessibility implication checking with isAccessible in Contexts
447447
def isOverrideAccessOK =
448-
val memberIsPublic = (member.flags & AccessFlags).isEmpty && !member.privateWithin.exists
449448
def protectedOK = !other.is(Protected) || member.is(Protected) // if o is protected, so is m
450449
def accessBoundaryOK =
451450
val ob = other.accessBoundary(member.owner)
@@ -454,7 +453,7 @@ object RefChecks {
454453
def companionBoundaryOK = ob.isClass && !ob.isLocalToBlock && mb.is(Module) && (ob.companionModule eq mb.companionModule)
455454
ob.isContainedIn(mb) || companionBoundaryOK // m relaxes o's access boundary,
456455
def otherIsJavaProtected = other.isAllOf(JavaProtected) // or o is Java defined and protected (see #3946)
457-
memberIsPublic || protectedOK && (accessBoundaryOK || otherIsJavaProtected)
456+
member.isPublic || protectedOK && (accessBoundaryOK || otherIsJavaProtected)
458457
end isOverrideAccessOK
459458

460459
if !member.hasTargetName(other.targetName) then
@@ -1069,8 +1068,7 @@ object RefChecks {
10691068
target.nonPrivateMember(sym.name)
10701069
.filterWithPredicate:
10711070
member =>
1072-
val memberIsPublic = (member.symbol.flags & AccessFlags).isEmpty && !member.symbol.privateWithin.exists
1073-
memberIsPublic && {
1071+
member.symbol.isPublic && {
10741072
val memberIsImplicit = member.info.hasImplicitParams
10751073
val paramTps =
10761074
if memberIsImplicit then methTp.stripPoly.firstParamTypes

0 commit comments

Comments
 (0)