Skip to content

Commit 56114ee

Browse files
committed
AST: Fix bug in AccessScope::intersectWith()
Noticed by inspection. I don't have a test case yet.
1 parent 4c914f5 commit 56114ee

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

include/swift/AST/AccessScope.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ class AccessScope {
6868
/// Returns the narrowest access scope if this and the specified access scope
6969
/// have common intersection, or None if scopes don't intersect.
7070
const Optional<AccessScope> intersectWith(AccessScope accessScope) const {
71-
if (hasEqualDeclContextWith(accessScope))
72-
return *this;
71+
if (hasEqualDeclContextWith(accessScope)) {
72+
if (isPrivate())
73+
return *this;
74+
return accessScope;
75+
}
7376
if (isChildOf(accessScope))
7477
return *this;
7578
if (accessScope.isChildOf(*this))

0 commit comments

Comments
 (0)