Skip to content

Commit 370b08a

Browse files
committed
Revise diagnostic message for availability fixit
1 parent f45196d commit 370b08a

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

include/swift/AST/DiagnosticsParse.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,7 @@ ERROR(avail_query_argument_and_shorthand_mix_not_allowed, PointsToFirstBadToken,
14771477
(StringRef, StringRef))
14781478

14791479
NOTE(avail_query_meant_introduced,PointsToFirstBadToken,
1480-
"did you mean to use '%0, introduced: %1'?", (StringRef, StringRef))
1480+
"did you mean to specify an introduction version?", ())
14811481

14821482
ERROR(avail_query_version_comparison_not_needed,
14831483
none,"version comparison not needed", ())

lib/Parse/ParseStmt.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,11 +1137,8 @@ Parser::parseAvailabilitySpecList(SmallVectorImpl<AvailabilitySpec *> &Specs) {
11371137
PlatformSpec->getPlatformLoc().getAdvancedLoc(
11381138
PlatformName.size());
11391139

1140-
StringRef VersionName = PlatformSpec->getVersion().getAsString();
1141-
11421140
diagnose(PlatformSpec->getPlatformLoc(),
1143-
diag::avail_query_meant_introduced, PlatformName,
1144-
VersionName)
1141+
diag::avail_query_meant_introduced)
11451142
.fixItInsert(PlatformNameEndLoc, ", introduced:");
11461143
}
11471144

test/Parse/diagnose_availability.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ func introducedFollowedByDeprecated() {}
1010

1111
@available(OSX 10.0, deprecated: 10.12)
1212
// expected-error@-1 {{'deprecated' can't be combined with shorthand specification 'OSX 10.0'}}
13-
// expected-note@-2 {{did you mean to use 'OSX, introduced: 10.0'?}} {{15-15=, introduced:}}
13+
// expected-note@-2 {{did you mean to specify an introduction version?}} {{15-15=, introduced:}}
1414
// expected-error@-3 {{expected declaration}}
1515
func shorthandFollowedByDeprecated() {}
1616

0 commit comments

Comments
 (0)