Skip to content

Commit 76886eb

Browse files
committed
[Diagnostics] Tailor using diagnostic to current use-case - default isolation
(cherry picked from commit ec9132c)
1 parent b65da0b commit 76886eb

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

include/swift/AST/DiagnosticsParse.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,8 +2184,8 @@ ERROR(nonisolated_nonsending_repeated,none,
21842184
// MARK: using @<attribute> or using <identifier>
21852185
//------------------------------------------------------------------------------
21862186
ERROR(using_decl_invalid_specifier,PointsToFirstBadToken,
2187-
"'using' declaration does not support %0 %select{modifier|attribute}1",
2188-
(Identifier, bool))
2187+
"default isolation can only be set to '@MainActor' or 'nonisolated'",
2188+
())
21892189
ERROR(experimental_using_decl_disabled,PointsToFirstBadToken,
21902190
"'using' is an experimental feature that is currently disabled", ())
21912191

lib/Parse/ParseDecl.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6680,8 +6680,7 @@ ParserResult<UsingDecl> Parser::parseDeclUsing(ParseDeclOptions Flags,
66806680
.Default(std::nullopt);
66816681

66826682
if (!Specifier) {
6683-
diagnose(SpecifierLoc, diag::using_decl_invalid_specifier, RawSpecifier,
6684-
AtLoc.isValid());
6683+
diagnose(SpecifierLoc, diag::using_decl_invalid_specifier);
66856684
return nullptr;
66866685
}
66876686

test/Parse/using.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ using @MainActor
1010
using nonisolated
1111
// expected-error@-1 {{invalid redeclaration of file-level default actor isolation}}
1212

13-
using @Test // expected-error {{'using' declaration does not support 'Test' attribute}}
14-
using test // expected-error {{'using' declaration does not support 'test' modifier}}
13+
using @Test // expected-error {{default isolation can only be set to '@MainActor' or 'nonisolated'}}
14+
using test // expected-error {{default isolation can only be set to '@MainActor' or 'nonisolated'}}
1515

1616
do {
1717
using // expected-warning {{expression of type 'Int' is unused}}

0 commit comments

Comments
 (0)