Skip to content

Commit 15056ed

Browse files
committed
Remove mistaken early exit from access checking
Warnings should not result in early exits because we might end up missing an error!
1 parent 3c740e4 commit 15056ed

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,15 +1645,13 @@ void AttributeChecker::visitAccessControlAttr(AccessControlAttr *attr) {
16451645
// lead to diagnostic fights between this and "declaration must be at
16461646
// least this accessible" checking for overrides and protocol
16471647
// requirements.
1648-
return;
16491648
} else if (attr->getAccess() == defaultAccess) {
16501649
TC.diagnose(attr->getLocation(),
16511650
diag::access_control_ext_member_redundant,
16521651
attr->getAccess(),
16531652
D->getDescriptiveKind(),
16541653
extAttr->getAccess())
16551654
.fixItRemove(attr->getRange());
1656-
return;
16571655
}
16581656
}
16591657
}

test/attr/accessibility.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,9 @@ extension PublicProto2 where Self.T : OuterClass, Self.U == Self.T.InnerClass {
229229
public func cannotBePublic() {}
230230
// expected-error@-1 {{cannot declare a public instance method in an extension with internal requirements}}
231231
}
232+
233+
public extension OuterClass {
234+
open convenience init(x: ()) { self.init() }
235+
// expected-warning@-1 {{'open' modifier conflicts with extension's default access of 'public'}}
236+
// expected-error@-2 {{only classes and overridable class members can be declared 'open'; use 'public'}}
237+
}

0 commit comments

Comments
 (0)