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
Adopters of the new Span and MutableSpan types should not encounter information
about an experimental feature when they attempt to use these types in
unsupported ways, such as simply returning them from a function.
Fixes rdar://151788740 (Diagnostic message: suppress printing "requires
'-enable-experimental-feature LifetimeDependence'")
(cherry picked from commit 50a69bc)
Copy file name to clipboardExpand all lines: test/Interop/Cxx/class/nonescapable-errors.swift
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -109,7 +109,7 @@ public func importInvalid(_ x: Invalid) {
109
109
}
110
110
111
111
// CHECK: error: a function with a ~Escapable result needs a parameter to depend on
112
-
// CHECK-NO-LIFETIMES: test.swift:11:32: error: a function with a ~Escapable result requires '-enable-experimental-feature LifetimeDependence'
112
+
// CHECK-NO-LIFETIMES: test.swift:11:32: error: a function cannot return a ~Escapable result
113
113
publicfunc noAnnotations()->View{
114
114
// CHECK: nonescapable.h:16:7: warning: the returned type 'Owner' is annotated as escapable; it cannot have lifetime dependencies [#ClangDeclarationImport]
115
115
// CHECK-NO-LIFETIMES: nonescapable.h:16:7: warning: the returned type 'Owner' is annotated as escapable; it cannot have lifetime dependencies [#ClangDeclarationImport]
@@ -121,12 +121,12 @@ public func noAnnotations() -> View {
121
121
f2(nil,nil)
122
122
// CHECK: nonescapable.h:24:6: warning: the returned type 'View' is annotated as non-escapable; its lifetime dependencies must be annotated [#ClangDeclarationImport]
123
123
// CHECK-NO-LIFETIMES: nonescapable.h:24:6: warning: the returned type 'View' is annotated as non-escapable; its lifetime dependencies must be annotated [#ClangDeclarationImport]
124
-
// CHECK-NO-LIFETIMES: nonescapable.h:24:6: error: a function with a ~Escapable result requires '-enable-experimental-feature LifetimeDependence'
124
+
// CHECK-NO-LIFETIMES: nonescapable.h:24:6: error: a function cannot return a ~Escapable result
125
125
g(nil)
126
126
h1(nil)
127
-
// CHECK-NO-LIFETIMES: nonescapable.h:34:21: error: a function with a ~Escapable result requires '-enable-experimental-feature LifetimeDependence'
127
+
// CHECK-NO-LIFETIMES: nonescapable.h:34:21: error: a function cannot return a ~Escapable result
128
128
h2(nil)
129
-
// CHECK-NO-LIFETIMES: nonescapable.h:35:21: error: a function with a ~Escapable result requires '-enable-experimental-feature LifetimeDependence'
129
+
// CHECK-NO-LIFETIMES: nonescapable.h:35:21: error: a function cannot return a ~Escapable result
130
130
h3(nil)
131
131
i1()
132
132
// CHECK: nonescapable.h:39:39: error: template parameter 'Missing' does not exist
@@ -135,18 +135,18 @@ public func noAnnotations() -> View {
135
135
// CHECK: nonescapable.h:45:33: error: template parameter 'S' expected to be a type parameter
136
136
// CHECK-NO-LIFETIMES: nonescapable.h:45:33: error: template parameter 'S' expected to be a type parameter
137
137
j1()
138
-
// CHECK-NO-LIFETIMES: nonescapable.h:63:41: error: a function with a ~Escapable result requires '-enable-experimental-feature LifetimeDependence'
138
+
// CHECK-NO-LIFETIMES: nonescapable.h:63:41: error: a function cannot return a ~Escapable result
139
139
j2()
140
-
// CHECK-NO-LIFETIMES: nonescapable.h:64:41: error: a function with a ~Escapable result requires '-enable-experimental-feature LifetimeDependence'
140
+
// CHECK-NO-LIFETIMES: nonescapable.h:64:41: error: a function cannot return a ~Escapable result
141
141
j3()
142
142
k1();
143
-
// CHECK-NO-LIFETIMES: nonescapable.h:70:15: error: a function with a ~Escapable result requires '-enable-experimental-feature LifetimeDependence'
143
+
// CHECK-NO-LIFETIMES: nonescapable.h:70:15: error: a function cannot return a ~Escapable result
144
144
k2();
145
-
// CHECK-NO-LIFETIMES: nonescapable.h:71:22: error: a function with a ~Escapable result requires '-enable-experimental-feature LifetimeDependence'
145
+
// CHECK-NO-LIFETIMES: nonescapable.h:71:22: error: a function cannot return a ~Escapable result
146
146
k3();
147
147
l1();
148
148
// CHECK: nonescapable.h:77:12: error: a function with a ~Escapable result needs a parameter to depend on
149
-
// CHECK-NO-LIFETIMES: nonescapable.h:77:12: error: a function with a ~Escapable result requires '-enable-experimental-feature LifetimeDependence'
149
+
// CHECK-NO-LIFETIMES: nonescapable.h:77:12: error: a function cannot return a ~Escapable result
struct NE :~Escapable { // expected-error{{an implicit initializer with a ~Escapable result requires '-enable-experimental-feature LifetimeDependence'}}
4
+
struct NE :~Escapable { // expected-error{{an implicit initializer cannot return a ~Escapable result}}
5
5
}
6
6
7
7
@lifetime(copy ne) // expected-error{{'@lifetime' attribute is only valid when experimental feature LifetimeDependence is enabled}} expected-error{{expected declaration}}
8
-
func derive(_ ne:NE)->NE{ // expected-error{{a function with a ~Escapable result requires '-enable-experimental-feature LifetimeDependence'}}
8
+
func derive(_ ne:NE)->NE{ // expected-error{{a function cannot return a ~Escapable result}}
Copy file name to clipboardExpand all lines: test/Sema/lifetime_depend_nofeature.swift
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -6,21 +6,21 @@
6
6
// Check that functions that require lifetime dependence are prohibited without the flag.
7
7
8
8
// Don't allow empty initialization.
9
-
structEmptyNonEscapable:~Escapable {} // expected-error{{an implicit initializer with a ~Escapable result requires '-enable-experimental-feature LifetimeDependence'}}
func neReturn(span:RawSpan)->RawSpan{ span } // expected-error{{a function with a ~Escapable result requires '-enable-experimental-feature LifetimeDependence'}}
12
+
func neReturn(span:RawSpan)->RawSpan{ span } // expected-error{{a function cannot return a ~Escapable result}}
13
13
14
-
func neInout(span:inoutRawSpan){} // expected-error{{a function with a ~Escapable 'inout' parameter requires '-enable-experimental-feature LifetimeDependence'}}
14
+
func neInout(span:inoutRawSpan){} // expected-error{{a function cannot have a ~Escapable 'inout' parameter 'span'}}
15
15
16
16
structS{
17
-
func neReturn(span:RawSpan)->RawSpan{ span } // expected-error{{a method with a ~Escapable result requires '-enable-experimental-feature LifetimeDependence'}}
func neInout(span:inoutRawSpan){} // expected-error{{a method with a ~Escapable 'inout' parameter requires '-enable-experimental-feature LifetimeDependence'}}
19
+
func neInout(span:inoutRawSpan){} // expected-error{{a method cannot have a ~Escapable 'inout' parameter 'span'}}
20
20
}
21
21
22
22
classC{
23
-
func neReturn(span:RawSpan)->RawSpan{ span } // expected-error{{a method with a ~Escapable result requires '-enable-experimental-feature LifetimeDependence'}}
0 commit comments