Skip to content

Commit 110839e

Browse files
committed
Add cross-module test
Verify importing noasync across modules works correctly.
1 parent 9003837 commit 110839e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
@_unavailableFromAsync
22
public func unavailableFunction() { }
3+
4+
@available(*, noasync)
5+
public func noasyncFunction() { }

test/Concurrency/unavailable_from_async.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,13 @@ 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}}
6768

6869
// Can use them from synchronous closures
6970
_ = { Bop() }()
7071
_ = { bop.foo() }()
7172
_ = { bop.muppet() }()
73+
_ = { noasyncFunction() }()
7274

7375
// Unavailable global function
7476
foo() // expected-warning{{'foo' is unavailable from asynchronous contexts}}
@@ -87,6 +89,7 @@ func asyncFunc() async { // expected-error{{asynchronous global function 'asyncF
8789
bop.foo() // expected-warning@:7{{'foo' is unavailable from asynchronous contexts}}
8890
bop.muppet() // expected-warning@:7{{'muppet' is unavailable from asynchronous contexts}}
8991
unavailableFunction() // expected-warning@:3{{'unavailableFunction' is unavailable from asynchronous contexts}}
92+
noasyncFunction() // expected-error@:3{{'noasyncFunction' is unavailable from asynchronous contexts}}
9093

9194
// Unavailable global function
9295
foo() // expected-warning{{'foo' is unavailable from asynchronous contexts}}
@@ -101,6 +104,7 @@ func asyncFunc() async { // expected-error{{asynchronous global function 'asyncF
101104
bop.foo()
102105
bop.muppet()
103106
unavailableFunction()
107+
noasyncFunction()
104108

105109
_ = { () async -> Void in
106110
// Check Unavailable things inside of a nested async closure
@@ -109,6 +113,7 @@ func asyncFunc() async { // expected-error{{asynchronous global function 'asyncF
109113
bop.muppet() // expected-warning@:11{{'muppet' is unavailable from asynchronous contexts}}
110114
_ = Bop() // expected-warning@:11{{'init' is unavailable from asynchronous contexts; Use Bop(a: Int) instead}}
111115
unavailableFunction() // expected-warning@:7{{'unavailableFunction' is unavailable from asynchronous contexts}}
116+
noasyncFunction() // expected-error@:7{{'noasyncFunction' is unavailable from asynchronous contexts}}
112117
}
113118
}
114119

@@ -118,6 +123,7 @@ func asyncFunc() async { // expected-error{{asynchronous global function 'asyncF
118123
bop.foo() // expected-warning@:9{{'foo' is unavailable from asynchronous contexts}}
119124
bop.muppet() // expected-warning@:9{{'muppet' is unavailable from asynchronous contexts}}
120125
unavailableFunction() // expected-warning@:5{{'unavailableFunction' is unavailable from asynchronous contexts}}
126+
noasyncFunction() // expected-error@:5{{'noasyncFunction' is unavailable from asynchronous contexts}}
121127

122128
_ = {
123129
foo()

0 commit comments

Comments
 (0)