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_keypaths.swift
+6-5Lines changed: 6 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -96,13 +96,13 @@ do {
96
96
testSendableFn(v: v, \.[42]) // Ok
97
97
98
98
testSendableKP(v: v, \.[NonSendable()]) // expected-warning {{type 'KeyPath<V, Int>' does not conform to the 'Sendable' protocol}}
99
-
// Note that there is no warning here because the key path is wrapped in a closure and not captured by it: `{ $0[keyPath: \.[NonSendable()]] }`
100
-
testSendableFn(v: v, \.[NonSendable()]) // Ok
99
+
testSendableFn(v: v, \.[NonSendable()]) // expected-warning {{converting non-sendable function value to '@Sendable (V) -> Int' may introduce data races}}
101
100
102
101
testNonSendableKP(v: v, \.[NonSendable()]) // Ok
103
102
testNonSendableFn(v: v, \.[NonSendable()]) // Ok
104
103
105
-
let _:@Sendable(V)->Int= \.[NonSendable()] // Ok
104
+
let _:@Sendable(V)->Int= \.[NonSendable()]
105
+
// expected-warning@-1 {{converting non-sendable function value to '@Sendable (V) -> Int' may introduce data races}}
106
106
107
107
let _:KeyPath<V,Int>&Sendable= \.[42,CondSendable(NonSendable(data:[1,2,3]))]
108
108
// expected-warning@-1 {{type 'ReferenceWritableKeyPath<V, Int>' does not conform to the 'Sendable' protocol}}
0 commit comments