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
[move-only] Add additional test coverage to nonescaping closure test.
Specifically:
1. I added consuming test cases alongside __owned test cases.
2. I inserted the actual error messages so that we can see if we are emitting
the correct error messages.
3. I enabled the NONTRIVIAL and NONTRIVIAL/REABSTRACT variants of the tests.
There are some differences in the address only version of the test that I am
still looking into.
// TODO: test with (-DNONTRIVIAL | -DADDRESS_ONLY) * (REABSTRACT)
3
5
4
6
protocolP{}
@@ -52,17 +54,33 @@ func b(x: __owned M) { // expected-error {{'x' used after consume}}
52
54
// expected-note @-2:37 {{consuming use here}}
53
55
}
54
56
57
+
func b2(x:consumingM){
58
+
clodger({borrow(x)}, // expected-note {{conflicting access is here}}
59
+
consume: x) // expected-error {{overlapping accesses to 'x', but deinitialization requires exclusive access}}
60
+
}
61
+
55
62
func c(x:__owned M){
56
63
clodger({borrow(x)})
57
64
borrow(x)
58
65
consume(x)
59
66
}
60
67
68
+
func c2(x:consumingM){
69
+
clodger({borrow(x)})
70
+
borrow(x)
71
+
consume(x)
72
+
}
73
+
61
74
func d(x:__owned M){ // expected-error {{'x' consumed in closure. This is illegal since if the closure is invoked more than once the binding will be uninitialized on later invocations}}
62
75
clodger({consume(x)})
63
76
// expected-note @-1 {{consuming use here}}
64
77
}
65
78
79
+
func d2(x:consumingM){ // expected-error {{'x' consumed in closure but not reinitialized before end of closure}}
0 commit comments