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
// expected-ni-note @-1 {{sending nonisolated(nonsending) task-isolated 'x' to nonisolated global function 'useValueAsyncConcurrent' risks causing data races between nonisolated and nonisolated(nonsending) task-isolated uses}}
2002
2002
// expected-ni-ns-note @-2 {{sending task-isolated 'x' to @concurrent global function 'useValueAsyncConcurrent' risks causing data races between @concurrent and task-isolated uses}}
2003
2003
}
2004
+
2005
+
enumRequireSrcWhenStoringEvenWhenSendable{
2006
+
func test<T:Sendable>(t:T){
2007
+
varresult:T= t
2008
+
Task{ // expected-warning {{sending value of non-Sendable type '() async -> ()' risks causing data races}}
2009
+
// expected-note @-1 {{Passing value of non-Sendable type '() async -> ()' as a 'sending' argument to initializer 'init(name:priority:operation:)' risks causing races in between local and caller code}}
2010
+
result = t
2011
+
}
2012
+
useValue(result) // expected-note {{access can happen concurrently}}
2013
+
}
2014
+
2015
+
func test2(){
2016
+
varresult:Any=0
2017
+
Task{ // expected-warning {{sending value of non-Sendable type '() async -> ()' risks causing data races}}
2018
+
// expected-note @-1 {{Passing value of non-Sendable type '() async -> ()' as a 'sending' argument to initializer 'init(name:priority:operation:)' risks causing races in between local and caller code}}
2019
+
result =0
2020
+
}
2021
+
useValue(result) // expected-note {{access can happen concurrently}}
Task{ // expected-warning {{sending value of non-Sendable type '() async -> ()' risks causing data races}}
2031
+
// expected-note @-1 {{Passing value of non-Sendable type '() async -> ()' as a 'sending' argument to initializer 'init(name:priority:operation:)' risks causing races in between local and caller code}}
2032
+
result = type.init()
2033
+
}
2034
+
useValue(result) // expected-note {{access can happen concurrently}}
0 commit comments