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
// (`Collection.makeIterator` and `IteratorProtocol.next`).
169
169
// expected-error @+1 {{function is not differentiable}}
170
170
@differentiable(reverse)
171
-
// expected-note @+1 {{when differentiating this function definition}}
171
+
// expected-note @+2 {{when differentiating this function definition}}
172
+
// expected-note @+1 {{cannot differentiate through a non-differentiable result; do you want to use 'withoutDerivative(at:)'?}} {{+2:12-12=withoutDerivative(at: }} {{+2:17-17=)}}
172
173
func loop_array(_ array:[Float])->Float{
173
-
// expected-note @-1 {{cannot differentiate through a non-differentiable result; do you want to use 'withoutDerivative(at:)'?}} {{12-12=withoutDerivative(at: }} {{17-17=)}}
publicfunc public_original_private_derivative(_ x:Float)->Float{ x }
1106
1106
// expected-error @+1 {{derivative function must have same access level as original function; derivative function '_public_original_private_derivative' is fileprivate, but original function 'public_original_private_derivative' is public}}
// expected-note @-1 {{mark the derivative function as '@usableFromInline' to match the original function}} {{-1:1-1=@usableFromInline }}
1110
1110
fatalError()
1111
1111
}
1112
1112
1113
1113
publicfunc public_original_internal_derivative(_ x:Float)->Float{ x }
1114
1114
// expected-error @+1 {{derivative function must have same access level as original function; derivative function '_public_original_internal_derivative' is internal, but original function 'public_original_internal_derivative' is public}}
init() // expected-note {{protocol requires initializer 'init()' with type '()'; do you want to add a stub?}} {{43-43=\n init() {\n <#code#>\n \}\n}}
144
-
}
145
-
146
142
structLocation{
147
143
varx:Int
148
144
vary:Int
@@ -152,6 +148,9 @@ struct Location {
152
148
}
153
149
}
154
150
151
+
protocolDefaultConstructable{
152
+
init() // expected-note {{protocol requires initializer 'init()' with type '()'; do you want to add a stub?}} {{+2:43-43=\n init() {\n <#code#>\n \}\n}}
153
+
}
155
154
extensionLocation:DefaultConstructable{} // expected-error {{type 'Location' does not conform to protocol 'DefaultConstructable'}}
Copy file name to clipboardExpand all lines: test/Concurrency/require-explicit-sendable.swift
+17-17Lines changed: 17 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -2,41 +2,41 @@
2
2
3
3
publicprotocolP{}
4
4
5
+
// expected-note@+2{{consider making struct 'S1' conform to the 'Sendable' protocol}}{{18-18=: Sendable}}
6
+
// expected-note@+1{{make struct 'S1' explicitly non-Sendable to suppress this warning}}{{+2:2-2=\n\n@available(*, unavailable)\nextension S1: Sendable { \}\n}}
5
7
publicstructS1{ // expected-warning{{public struct 'S1' does not specify whether it is 'Sendable' or not}}
6
-
// expected-note@-1{{consider making struct 'S1' conform to the 'Sendable' protocol}}{{18-18=: Sendable}}
7
-
// expected-note@-2{{make struct 'S1' explicitly non-Sendable to suppress this warning}}{{2-2=\n\n@available(*, unavailable)\nextension S1: Sendable { \}\n}}
8
8
varstr:String
9
9
}
10
10
11
11
classC{}
12
12
13
+
// expected-note@+2{{add '@unchecked Sendable' conformance to struct 'S2' if this type manually implements concurrency safety}}{{18-18=: @unchecked Sendable}}
14
+
// expected-note@+1{{make struct 'S2' explicitly non-Sendable to suppress this warning}}{{+2:2-2=\n\n@available(*, unavailable)\nextension S2: Sendable { \}\n}}
13
15
publicstructS2{ // expected-warning{{public struct 'S2' does not specify whether it is 'Sendable' or not}}
14
-
// expected-note@-1{{add '@unchecked Sendable' conformance to struct 'S2' if this type manually implements concurrency safety}}{{18-18=: @unchecked Sendable}}
15
-
// expected-note@-2{{make struct 'S2' explicitly non-Sendable to suppress this warning}}{{2-2=\n\n@available(*, unavailable)\nextension S2: Sendable { \}\n}}
16
16
varc:C
17
17
}
18
18
19
+
// expected-note@+2{{consider making class 'C1' conform to the 'Sendable' protocol}}{{25-25=, Sendable}}
20
+
// expected-note@+1{{make class 'C1' explicitly non-Sendable to suppress this warning}}{{+2:2-2=\n\n@available(*, unavailable)\nextension C1: Sendable { \}\n}}
19
21
finalpublicclassC1:P{ // expected-warning{{public class 'C1' does not specify whether it is 'Sendable' or not}}
20
-
// expected-note@-1{{consider making class 'C1' conform to the 'Sendable' protocol}}{{25-25=, Sendable}}
21
-
// expected-note@-2{{make class 'C1' explicitly non-Sendable to suppress this warning}}{{2-2=\n\n@available(*, unavailable)\nextension C1: Sendable { \}\n}}
22
22
letstr:String=""
23
23
}
24
24
25
+
// expected-note@+2{{add '@unchecked Sendable' conformance to class 'C2' if this type manually implements concurrency safety}}{{17-17=: @unchecked Sendable}}
26
+
// expected-note@+1{{make class 'C2' explicitly non-Sendable to suppress this warning}}{{+2:2-2=\n\n@available(*, unavailable)\nextension C2: Sendable { \}\n}}
25
27
publicclassC2{ // expected-warning{{public class 'C2' does not specify whether it is 'Sendable' or not}}
26
-
// expected-note@-1{{add '@unchecked Sendable' conformance to class 'C2' if this type manually implements concurrency safety}}{{17-17=: @unchecked Sendable}}
27
-
// expected-note@-2{{make class 'C2' explicitly non-Sendable to suppress this warning}}{{2-2=\n\n@available(*, unavailable)\nextension C2: Sendable { \}\n}}
28
28
varstr:String=""
29
29
}
30
30
31
+
// expected-note@+2{{consider making generic struct 'S3' conform to the 'Sendable' protocol}}{{+2:2-2=\n\nextension S3: Sendable where T: Sendable { \}\n}}
32
+
// expected-note@+1{{make generic struct 'S3' explicitly non-Sendable to suppress this warning}}{{+2:2-2=\n\n@available(*, unavailable)\nextension S3: Sendable { \}\n}}
31
33
publicstructS3<T>{ // expected-warning{{public generic struct 'S3' does not specify whether it is 'Sendable' or not}}
32
-
// expected-note@-1{{consider making generic struct 'S3' conform to the 'Sendable' protocol}}{{2-2=\n\nextension S3: Sendable where T: Sendable { \}\n}}
33
-
// expected-note@-2{{make generic struct 'S3' explicitly non-Sendable to suppress this warning}}{{2-2=\n\n@available(*, unavailable)\nextension S3: Sendable { \}\n}}
34
34
vart:T
35
35
}
36
36
37
+
// expected-note@+2{{add '@unchecked Sendable' conformance to generic struct 'S4' if this type manually implements concurrency safety}}{{+3:2-2=\n\nextension S4: @unchecked Sendable where T: Sendable { \}\n}}
38
+
// expected-note@+1{{make generic struct 'S4' explicitly non-Sendable to suppress this warning}}{{+3:2-2=\n\n@available(*, unavailable)\nextension S4: Sendable { \}\n}}
37
39
publicstructS4<T>{ // expected-warning{{public generic struct 'S4' does not specify whether it is 'Sendable' or not}}
38
-
// expected-note@-1{{add '@unchecked Sendable' conformance to generic struct 'S4' if this type manually implements concurrency safety}}{{2-2=\n\nextension S4: @unchecked Sendable where T: Sendable { \}\n}}
39
-
// expected-note@-2{{make generic struct 'S4' explicitly non-Sendable to suppress this warning}}{{2-2=\n\n@available(*, unavailable)\nextension S4: Sendable { \}\n}}
40
40
vart:T
41
41
varc:C
42
42
}
@@ -71,20 +71,20 @@ func testMe(s5: S5, s7: S7) {
71
71
acceptSendable(s7) // expected-warning{{conformance of 'S7' to 'Sendable' is unavailable}}
72
72
}
73
73
74
+
// expected-note@+2{{consider making generic struct 'S8' conform to the 'Sendable' protocol}}{{+2:2-2=\n\nextension S8: Sendable where T: Sendable, U: Sendable, V: Sendable { \}\n}}
75
+
// expected-note@+1{{make generic struct 'S8' explicitly non-Sendable to suppress this warning}}
74
76
publicstructS8<T:Hashable, U, V>{ // expected-warning{{public generic struct 'S8' does not specify whether it is 'Sendable' or not}}
75
-
// expected-note@-1{{consider making generic struct 'S8' conform to the 'Sendable' protocol}}{{2-2=\n\nextension S8: Sendable where T: Sendable, U: Sendable, V: Sendable { \}\n}}
76
-
// expected-note@-2{{make generic struct 'S8' explicitly non-Sendable to suppress this warning}}
77
77
varmember:[T:(U,V?)]
78
78
}
79
79
80
80
publicprotocolP2{
81
81
associatedtypeA
82
82
}
83
83
84
+
// expected-warning@+3{{public generic struct 'S9' does not specify whether it is 'Sendable' or not}}
85
+
// expected-note@+2{{consider making generic struct 'S9' conform to the 'Sendable' protocol}}{{+2:2-2=\n\nextension S9: Sendable where T: Sendable, T.A: Sendable { \}\n}}
86
+
// expected-note@+1{{make generic struct 'S9' explicitly non-Sendable to suppress this warning}}
84
87
publicstructS9<T:P2&Hashable>{
85
-
// expected-warning@-1{{public generic struct 'S9' does not specify whether it is 'Sendable' or not}}
86
-
// expected-note@-2{{consider making generic struct 'S9' conform to the 'Sendable' protocol}}{{2-2=\n\nextension S9: Sendable where T: Sendable, T.A: Sendable { \}\n}}
87
-
// expected-note@-3{{make generic struct 'S9' explicitly non-Sendable to suppress this warning}}
0 commit comments