@@ -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,16 +1068,18 @@ object RefChecks {
10691068 target.nonPrivateMember(sym.name)
10701069 .filterWithPredicate:
10711070 member =>
1072- val memberIsImplicit = member.info.hasImplicitParams
1073- val paramTps =
1074- if memberIsImplicit then methTp.stripPoly.firstParamTypes
1075- else methTp.firstExplicitParamTypes
1076-
1077- paramTps.isEmpty || memberIsImplicit && ! methTp.hasImplicitParams || {
1078- val memberParamTps = member.info.stripPoly.firstParamTypes
1079- ! memberParamTps.isEmpty
1080- && memberParamTps.lengthCompare(paramTps) == 0
1081- && memberParamTps.lazyZip(paramTps).forall((m, x) => x frozen_<:< m)
1071+ member.symbol.isPublic && {
1072+ val memberIsImplicit = member.info.hasImplicitParams
1073+ val paramTps =
1074+ if memberIsImplicit then methTp.stripPoly.firstParamTypes
1075+ else methTp.firstExplicitParamTypes
1076+
1077+ paramTps.isEmpty || memberIsImplicit && ! methTp.hasImplicitParams || {
1078+ val memberParamTps = member.info.stripPoly.firstParamTypes
1079+ ! memberParamTps.isEmpty
1080+ && memberParamTps.lengthCompare(paramTps) == 0
1081+ && memberParamTps.lazyZip(paramTps).forall((m, x) => x frozen_<:< m)
1082+ }
10821083 }
10831084 .exists
10841085 if ! target.typeSymbol.denot.isAliasType && ! target.typeSymbol.denot.isOpaqueAlias && hidden
0 commit comments