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/global_actor_inference.swift
+28Lines changed: 28 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -370,6 +370,34 @@ actor ActorWithWrapper {
370
370
}
371
371
}
372
372
373
+
@propertyWrapper
374
+
structWrapperOnSomeGlobalActor<Wrapped>{
375
+
@actorIndependent(unsafe)privatevarstored:Wrapped
376
+
377
+
nonisolatedinit(wrappedValue:Wrapped){
378
+
stored = wrappedValue
379
+
}
380
+
381
+
@SomeGlobalActorvarwrappedValue:Wrapped{
382
+
get{ stored }
383
+
set{ stored = newValue }
384
+
}
385
+
}
386
+
387
+
structInferredFromPropertyWrapper{
388
+
@WrapperOnSomeGlobalActorvarvalue=17
389
+
390
+
func test()->Int{ // expected-note{{calls to instance method 'test()' from outside of its actor context are implicitly asynchronous}}
391
+
value
392
+
}
393
+
}
394
+
395
+
func testInferredFromWrapper(x:InferredFromPropertyWrapper){ // expected-note{{add '@SomeGlobalActor' to make global function 'testInferredFromWrapper(x:)' part of global actor 'SomeGlobalActor'}}
396
+
_ = x.test() // expected-error{{instance method 'test()' isolated to global actor 'SomeGlobalActor' can not be referenced from this synchronous context}}
0 commit comments