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
Copy file name to clipboardExpand all lines: test/Concurrency/sendable_checking.swift
+15-2Lines changed: 15 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -131,7 +131,10 @@ protocol P {
131
131
func foo2<T :Sendable>(x :T)async->()
132
132
133
133
func bar2<T>(x :T)async->()
134
-
// expected-note@-1 {{consider making generic parameter 'T' conform to the 'Sendable' protocol}}
134
+
// expected-note@-1 {{consider making generic parameter 'T' conform to the 'Sendable' protocol}} {{14-14=: Sendable}}
135
+
136
+
func bar3<T:Equatable>(x :T)async->()
137
+
// expected-note@-1 {{consider making generic parameter 'T' conform to the 'Sendable' protocol}} {{25-25= & Sendable}}
135
138
}
136
139
137
140
// Make sure conformance to protocols checks sendability of
@@ -147,6 +150,9 @@ protocol P {
147
150
148
151
func bar2<T>(x :T)->(){}
149
152
// expected-warning@-1 {{non-sendable parameter type 'T' cannot be sent from caller of protocol requirement 'bar2(x:)' into actor-isolated implementation}}
153
+
154
+
func bar3<T:Equatable>(x :T)->(){}
155
+
// expected-warning@-1 {{non-sendable parameter type 'T' cannot be sent from caller of protocol requirement 'bar3(x:)' into actor-isolated implementation}}
150
156
}
151
157
152
158
@available(SwiftStdlib 5.1,*)
@@ -163,7 +169,11 @@ class Super {
163
169
164
170
@MainActor
165
171
func bar2<T>(x:T)async{}
166
-
// expected-note@-1 {{consider making generic parameter 'T' conform to the 'Sendable' protocol}}
172
+
// expected-note@-1 {{consider making generic parameter 'T' conform to the 'Sendable' protocol}} {{14-14=: Sendable}}
173
+
174
+
@MainActor
175
+
func bar3<T:Equatable>(x:T)async{}
176
+
// expected-note@-1 {{consider making generic parameter 'T' conform to the 'Sendable' protocol}} {{25-25= & Sendable}}
167
177
}
168
178
169
179
// Make sure isolation crossing overrides check sendability
@@ -179,6 +189,9 @@ class Sub : Super {
179
189
180
190
overridenonisolatedfunc bar2<T>(x:T)async{}
181
191
// expected-warning@-1 {{non-sendable parameter type 'T' cannot be sent from caller of superclass instance method 'bar2(x:)' into nonisolated override}}
192
+
193
+
overridenonisolatedfunc bar3<T>(x:T)async{}
194
+
// expected-warning@-1 {{non-sendable parameter type 'T' cannot be sent from caller of superclass instance method 'bar3(x:)' into nonisolated override}}
0 commit comments