-
Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathswift-version.sil
30 lines (24 loc) · 1.34 KB
/
swift-version.sil
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// RUN: %target-sil-opt -send-non-sendable -strict-concurrency=complete -swift-version 5 %s -verify -verify-additional-prefix complete-
// RUN: %target-sil-opt -send-non-sendable -swift-version 6 %s -verify -verify-additional-prefix tns-
// READ THIS: This test takes advantage of the semantics of concurrency to
// validate that sil-opt can properly set the swift-version flag in a way that
// the rest of the compiler can understand. Please do not add actual concurrency
// code to this test and always keep it simple if additional code needs to be
// added since we aren't actually trying to test concurrency here!
// REQUIRES: asserts
// REQUIRES: concurrency
import Swift
import _Concurrency
class NonSendableKlass {}
sil @transfer_to_main : $@convention(thin) @async (@guaranteed NonSendableKlass) -> ()
sil [ossa] @test : $@convention(thin) @async (@guaranteed NonSendableKlass) -> () {
bb0(%0 : @guaranteed $NonSendableKlass):
%1 = function_ref @transfer_to_main : $@convention(thin) @async (@guaranteed NonSendableKlass) -> ()
apply [caller_isolation=nonisolated] [callee_isolation=global_actor] %1(%0) : $@convention(thin) @async (@guaranteed NonSendableKlass) -> ()
// expected-complete-warning @-1 {{}}
// expected-complete-note @-2 {{}}
// expected-tns-error @-3 {{}}
// expected-tns-note @-4 {{}}
%9999 = tuple ()
return %9999 : $()
}