mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Make it more comprehensive to warn when redundant access
modifier is used in an extension. In addition, add warnings for access modifier redundancy on property setters; and address comments from Jordan Rose.
This commit is contained in:
@@ -3952,7 +3952,7 @@ void swift::performStmtDiagnostics(TypeChecker &TC, const Stmt *S) {
|
||||
|
||||
void swift::fixItAccess(InFlightDiagnostic &diag, ValueDecl *VD,
|
||||
AccessLevel desiredAccess, bool isForSetter,
|
||||
bool shouldNotReplace) {
|
||||
bool shouldUseDefaultAccess) {
|
||||
StringRef fixItString;
|
||||
switch (desiredAccess) {
|
||||
case AccessLevel::Private: fixItString = "private "; break;
|
||||
@@ -3998,7 +3998,7 @@ void swift::fixItAccess(InFlightDiagnostic &diag, ValueDecl *VD,
|
||||
// this function is sometimes called to make access narrower, so assuming
|
||||
// that a broader scope is acceptable breaks some diagnostics.
|
||||
if (attr->getAccess() != desiredAccess) {
|
||||
if (shouldNotReplace) {
|
||||
if (shouldUseDefaultAccess) {
|
||||
// Remove the attribute if replacement is not preferred.
|
||||
diag.fixItRemove(attr->getRange());
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user