Skip to content

Commit 26fcd8c

Browse files
authored
Merge pull request #4287 from CodaFi/handy-mannys-big-constructor-job
Fix @available renaming for renamed initializers
2 parents f67cb0d + 96ff452 commit 26fcd8c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/Sema/MiscDiagnostics.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,18 +1397,18 @@ void swift::fixItAvailableAttrRename(TypeChecker &TC,
13971397
if (parsed.isMember()) {
13981398
diag.fixItReplace(call->getFn()->getSourceRange(), parsed.ContextName);
13991399

1400-
} else {
1401-
auto *dotCall = dyn_cast<DotSyntaxCallExpr>(call->getFn());
1402-
if (!dotCall)
1403-
return;
1404-
1400+
} else if (auto *dotCall = dyn_cast<DotSyntaxCallExpr>(call->getFn())) {
14051401
SourceLoc removeLoc = dotCall->getDotLoc();
14061402
if (removeLoc.isInvalid())
14071403
return;
14081404

14091405
diag.fixItRemove(SourceRange(removeLoc, dotCall->getFn()->getEndLoc()));
1406+
} else if (!isa<ConstructorRefCallExpr>(call->getFn())) {
1407+
return;
14101408
}
14111409

1410+
// Continue on to diagnose any constructor argument label renames.
1411+
14121412
} else {
14131413
// Just replace the base name.
14141414
SmallString<64> baseReplace;

test/1_stdlib/StringDiagnostics_without_Foundation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ func testStringCollectionTypes(s: String) {
2727
struct NotLosslessStringConvertible {}
2828

2929
func testStringInitT() {
30-
_ = String(NotLosslessStringConvertible()) // expected-error{{'init' has been renamed to 'init(describing:)}}
30+
_ = String(NotLosslessStringConvertible()) // expected-error{{'init' has been renamed to 'init(describing:)}}{{14-14=describing: }}
3131
}

0 commit comments

Comments
 (0)