Skip to content

Commit 6c7cc3e

Browse files
committed
Merge remote-tracking branch 'origin/main' into rebranch
2 parents e7f2938 + 70fb926 commit 6c7cc3e

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

lib/Sema/TypeCheckAvailability.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3573,11 +3573,13 @@ diagnoseDeclUnavailableFromAsync(const ValueDecl *D, SourceRange R,
35733573
return false;
35743574

35753575
ASTContext &ctx = Where.getDeclContext()->getASTContext();
3576+
// @available(noasync) spelling
35763577
if (const AvailableAttr *attr = D->getAttrs().getNoAsync(ctx)) {
35773578
SourceLoc diagLoc = call ? call->getLoc() : R.Start;
35783579
auto diag = ctx.Diags.diagnose(diagLoc, diag::async_unavailable_decl,
35793580
D->getDescriptiveKind(), D->getBaseName(),
35803581
attr->Message);
3582+
diag.warnUntilSwiftVersion(6);
35813583

35823584
if (!attr->Rename.empty()) {
35833585
fixItAvailableAttrRename(diag, R, D, attr, call);
@@ -3590,7 +3592,7 @@ diagnoseDeclUnavailableFromAsync(const ValueDecl *D, SourceRange R,
35903592

35913593
if (!hasUnavailableAttr)
35923594
return false;
3593-
// @available(noasync) spelling
3595+
// @_unavailableFromAsync spelling
35943596
const UnavailableFromAsyncAttr *attr =
35953597
D->getAttrs().getAttribute<UnavailableFromAsyncAttr>();
35963598
SourceLoc diagLoc = call ? call->getLoc() : R.Start;

test/Concurrency/unavailable_from_async.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func makeAsyncClosuresSynchronously(bop: inout Bop) -> (() async -> Void) {
6464
bop.foo() // expected-warning@:9{{'foo' is unavailable from asynchronous contexts}}
6565
bop.muppet() // expected-warning@:9{{'muppet' is unavailable from asynchronous contexts}}
6666
unavailableFunction() // expected-warning@:5{{'unavailableFunction' is unavailable from asynchronous contexts}}
67-
noasyncFunction() // expected-error@:5{{'noasyncFunction' is unavailable from asynchronous contexts}}
67+
noasyncFunction() // expected-warning@:5{{'noasyncFunction' is unavailable from asynchronous contexts}}
6868

6969
// Can use them from synchronous closures
7070
_ = { Bop() }()
@@ -89,7 +89,7 @@ func asyncFunc() async { // expected-error{{asynchronous global function 'asyncF
8989
bop.foo() // expected-warning@:7{{'foo' is unavailable from asynchronous contexts}}
9090
bop.muppet() // expected-warning@:7{{'muppet' is unavailable from asynchronous contexts}}
9191
unavailableFunction() // expected-warning@:3{{'unavailableFunction' is unavailable from asynchronous contexts}}
92-
noasyncFunction() // expected-error@:3{{'noasyncFunction' is unavailable from asynchronous contexts}}
92+
noasyncFunction() // expected-warning@:3{{'noasyncFunction' is unavailable from asynchronous contexts}}
9393

9494
// Unavailable global function
9595
foo() // expected-warning{{'foo' is unavailable from asynchronous contexts}}
@@ -113,7 +113,7 @@ func asyncFunc() async { // expected-error{{asynchronous global function 'asyncF
113113
bop.muppet() // expected-warning@:11{{'muppet' is unavailable from asynchronous contexts}}
114114
_ = Bop() // expected-warning@:11{{'init' is unavailable from asynchronous contexts; Use Bop(a: Int) instead}}
115115
unavailableFunction() // expected-warning@:7{{'unavailableFunction' is unavailable from asynchronous contexts}}
116-
noasyncFunction() // expected-error@:7{{'noasyncFunction' is unavailable from asynchronous contexts}}
116+
noasyncFunction() // expected-warning@:7{{'noasyncFunction' is unavailable from asynchronous contexts}}
117117
}
118118
}
119119

@@ -123,7 +123,7 @@ func asyncFunc() async { // expected-error{{asynchronous global function 'asyncF
123123
bop.foo() // expected-warning@:9{{'foo' is unavailable from asynchronous contexts}}
124124
bop.muppet() // expected-warning@:9{{'muppet' is unavailable from asynchronous contexts}}
125125
unavailableFunction() // expected-warning@:5{{'unavailableFunction' is unavailable from asynchronous contexts}}
126-
noasyncFunction() // expected-error@:5{{'noasyncFunction' is unavailable from asynchronous contexts}}
126+
noasyncFunction() // expected-warning@:5{{'noasyncFunction' is unavailable from asynchronous contexts}}
127127

128128
_ = {
129129
foo()

test/attr/attr_availability_noasync.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ actor IOActor {
2727

2828
@available(SwiftStdlib 5.5, *)
2929
func asyncFunc() async {
30-
// expected-error@+1{{global function 'basicNoAsync' is unavailable from asynchronous contexts}}
30+
// expected-warning@+1{{global function 'basicNoAsync' is unavailable from asynchronous contexts; this is an error in Swift 6}}
3131
basicNoAsync()
3232

33-
// expected-error@+1{{global function 'messageNoAsync' is unavailable from asynchronous contexts; a message from the author}}
33+
// expected-warning@+1{{global function 'messageNoAsync' is unavailable from asynchronous contexts; a message from the author}}
3434
messageNoAsync()
3535

36-
// expected-error@+1{{global function 'renamedNoAsync' is unavailable from asynchronous contexts}}{{5-19=asyncReplacement}}
36+
// expected-warning@+1{{global function 'renamedNoAsync' is unavailable from asynchronous contexts}}{{5-19=asyncReplacement}}
3737
renamedNoAsync() { _ in }
3838

39-
// expected-error@+1{{global function 'readStringFromIO' is unavailable from asynchronous contexts}}{{13-29=IOActor.readString}}
39+
// expected-warning@+1{{global function 'readStringFromIO' is unavailable from asynchronous contexts}}{{13-29=IOActor.readString}}
4040
let _ = readStringFromIO()
4141
}
4242

0 commit comments

Comments
 (0)