File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 33// RUN: -verify \
44// RUN: -sil-verify-all \
55// RUN: -module-name test \
6- // RUN: -enable-experimental-feature NoncopyableGenerics \
7- // RUN: -enable-experimental-feature NonescapableTypes
6+ // RUN: -enable-experimental-feature NonescapableTypes \
7+ // RUN: -enable-experimental-feature NoncopyableGenerics
88
99// REQUIRES: asserts
1010// REQUIRES: swift_in_compiler
@@ -54,3 +54,15 @@ func bv_get_consume(container: consuming NE) -> BV {
5454 // expected-note @-2{{this use causes the lifetime-dependent value to escape}}
5555}
5656
57+ struct Wrapper : ~ Escapable {
58+ let bv : BV
59+ }
60+
61+ func bv_incorrect_annotation1( _ bv1: borrowing BV , _ bv2: borrowing BV ) -> dependsOn( bv2 ) BV { // expected-error {{lifetime-dependent variable 'bv1' escapes its scope}}
62+ return copy bv1 // expected-note @-1{{it depends on the lifetime of argument 'bv1'}}
63+ } // expected-note @-1{{this use causes the lifetime-dependent value to escape}}
64+
65+ func bv_incorrect_annotation2( _ w1: borrowing Wrapper , _ w2: borrowing Wrapper ) -> dependsOn( w2 ) BV { // expected-error {{lifetime-dependent variable 'w1' escapes its scope}}
66+ return w1. bv // expected-note @-1{{it depends on the lifetime of argument 'w1'}}
67+ } // expected-note @-1{{this use causes the lifetime-dependent value to escape}}
68+
You can’t perform that action at this time.
0 commit comments