You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I also extended the tests to handle more interesting cases.
NOTE: There are a few cases where we introduced some new do not understand
errors. I am going to fix that in the next commit. I just wanted to completely
update the tests for the manner in which the allocbox to stack change affects
them.
// CHECK: } // end sil function '$s16moveonly_closure29testLocalLetClosureCaptureVaryyFyycfU_'
127
127
func testLocalLetClosureCaptureVar(){
128
128
varx=SingleElt()
129
+
// expected-error @-1 {{'x' consumed more than once}}
130
+
// expected-error @-2 {{'x' used after consume}}
131
+
// expected-error @-3 {{'x' used after consume}}
129
132
x =SingleElt()
130
133
letf={
131
134
borrowVal(x)
132
-
consumeVal(x) // expected-error {{'x' was consumed but it is illegal to consume a noncopyable mutable capture of an escaping closure. One can only read from it or assign over it}}
133
-
consumeVal(x) // expected-error {{'x' was consumed but it is illegal to consume a noncopyable mutable capture of an escaping closure. One can only read from it or assign over it}}
134
-
borrowConsumeVal(x, x) // expected-error {{'x' was consumed but it is illegal to consume a noncopyable mutable capture of an escaping closure. One can only read from it or assign over it}}
135
+
consumeVal(x) // expected-note {{consuming use here}}
136
+
consumeVal(x) // expected-note {{consuming use here}}
137
+
// expected-note @-1 {{consuming use here}}
138
+
borrowConsumeVal(x, x)
135
139
// expected-error @-1 {{overlapping accesses, but deinitialization requires exclusive access}}
136
140
// expected-note @-2 {{conflicting access is here}}
// CHECK: } // end sil function '$s16moveonly_closure026testLocalLetClosureCaptureE0yyFyycfU_'
410
417
func testLocalLetClosureCaptureLet(){
411
418
letx=SingleElt()
419
+
// expected-error @-1 {{'x' consumed in closure. This is illegal since if the closure is invoked more than once the binding will be uninitialized on later invocations}}
420
+
// expected-error @-2 {{'x' consumed in closure. This is illegal since if the closure is invoked more than once the binding will be uninitialized on later invocations}}
421
+
// expected-error @-3 {{'x' consumed in closure. This is illegal since if the closure is invoked more than once the binding will be uninitialized on later invocations}}
412
422
letf={
413
423
borrowVal(x)
414
-
consumeVal(x) // expected-error {{'x' was consumed but it is illegal to consume a noncopyable immutable capture of an escaping closure. One can only read from it}}
415
-
consumeVal(x) // expected-error {{'x' was consumed but it is illegal to consume a noncopyable immutable capture of an escaping closure. One can only read from it}}
416
-
borrowConsumeVal(x, x) // expected-error {{'x' was consumed but it is illegal to consume a noncopyable immutable capture of an escaping closure. One can only read from it}}
424
+
consumeVal(x) // expected-note {{consuming use here}}
425
+
consumeVal(x) // expected-note {{consuming use here}}
426
+
borrowConsumeVal(x, x) // expected-note {{consuming use here}}
consumeVal(x) // expected-error {{'x' was consumed but it is illegal to consume a noncopyable mutable capture of an escaping closure. One can only read from it or assign over it}}
// expected-error @-1 {{'x' consumed in closure. This is illegal since if the closure is invoked more than once the binding will be uninitialized on later invocations}}
1174
+
// expected-error @-2 {{'x' consumed in closure. This is illegal since if the closure is invoked more than once the binding will be uninitialized on later invocations}}
1175
+
// expected-error @-3 {{'x' consumed in closure. This is illegal since if the closure is invoked more than once the binding will be uninitialized on later invocations}}
1139
1176
letf={
1140
1177
borrowVal(x)
1141
-
consumeVal(x) // expected-error {{'x' was consumed but it is illegal to consume a noncopyable immutable capture of an escaping closure. One can only read from it}}
1142
-
consumeVal(x) // expected-error {{'x' was consumed but it is illegal to consume a noncopyable immutable capture of an escaping closure. One can only read from it}}
1143
-
borrowConsumeVal(x, x) // expected-error {{'x' was consumed but it is illegal to consume a noncopyable immutable capture of an escaping closure. One can only read from it}}
1178
+
consumeVal(x) // expected-note {{consuming use here}}
1179
+
consumeVal(x) // expected-note {{consuming use here}}
1180
+
borrowConsumeVal(x, x) // expected-note {{consuming use here}}
0 commit comments