File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: not --crash %target-sil-opt -enable-sil-verify-all -enforce-exclusivity=unchecked -diagnose-static-exclusivity %s 2> %t/err.txt
3
+ // RUN: %FileCheck %s < %t/err.txt
4
+
5
+ // REQUIRES: asserts
6
+
7
+ // The test in this file is meant to fail during verification which currently
8
+ // only runs in the diagnose-static-exclusivity pass, but will eventually run in
9
+ // SIL verification.
10
+
11
+ import Builtin
12
+ import Swift
13
+
14
+ // CHECK: Argument must be @noescape function type: %{{.*}} = partial_apply
15
+ // CHECK: A partial_apply with @inout_aliasable may only be used as a @noescape function type argument.
16
+
17
+ sil @takesEscapingClosure : $@convention(thin) (@owned @callee_owned () -> ()) -> ()
18
+
19
+ sil hidden @closureWithArgument : $@convention(thin) (@inout_aliasable Int) -> () {
20
+ bb0(%1 : $*Int):
21
+ %3 = tuple ()
22
+ return %3 : $()
23
+ }
24
+
25
+ sil @missingNoescape : $@convention(thin) (Int) ->() {
26
+ bb0(%0 : $Int):
27
+ %2 = alloc_box ${ var Int }
28
+ %3 = project_box %2 : ${ var Int }, 0
29
+ store %0 to [trivial] %3 : $*Int
30
+ %4 = function_ref @takesEscapingClosure : $@convention(thin) (@owned @callee_owned () -> ()) -> ()
31
+ %5 = function_ref @closureWithArgument : $@convention(thin) (@inout_aliasable Int) -> ()
32
+ %6 = partial_apply %5(%3) : $@convention(thin) (@inout_aliasable Int) -> ()
33
+ %8 = apply %4(%6) : $@convention(thin) (@owned @callee_owned () -> ()) -> ()
34
+ %9 = tuple ()
35
+ return %9 : $()
36
+ }
You can’t perform that action at this time.
0 commit comments