File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -457,7 +457,51 @@ func testInferredFromWrapper(x: InferredFromPropertyWrapper) { // expected-note{
457
457
_ = x. test ( ) // expected-error{{call to global actor 'SomeGlobalActor'-isolated instance method 'test()' in a synchronous nonisolated context}}
458
458
}
459
459
460
+ @propertyWrapper
461
+ struct SimplePropertyWrapper {
462
+ var wrappedValue : Int { . zero }
463
+ var projectedValue : Int { . max }
464
+ }
465
+
466
+ // https://github.com/apple/swift/issues/59380
467
+ // https://github.com/apple/swift/issues/59494
468
+
469
+ // Make sure the nonisolated attribute propagates to the synthesized projectedValue
470
+ // variable as well.
471
+
472
+ @MainActor
473
+ class HasNonIsolatedProperty {
474
+ @SimplePropertyWrapper nonisolated var value
475
+
476
+ deinit {
477
+ _ = value
478
+ _ = $value // Ok
479
+ }
480
+ }
481
+
482
+ @propertyWrapper
483
+ struct SimplePropertyWrapper2 {
484
+ var wrappedValue : Int
485
+ var projectedValue : SimplePropertyWrapper2 { self }
486
+ }
487
+
488
+ @MainActor
489
+ class HasNonIsolatedProperty2 {
490
+ @SimplePropertyWrapper2 nonisolated var value = 0
491
+ nonisolated init ( ) { }
492
+ }
460
493
494
+ let hasNonIsolatedProperty2 = HasNonIsolatedProperty2 ( )
495
+
496
+ Task { @MainActor in
497
+ hasNonIsolatedProperty2. value = 10
498
+ _ = hasNonIsolatedProperty2. $value. wrappedValue
499
+ }
500
+
501
+ Task . detached {
502
+ hasNonIsolatedProperty2. value = 10
503
+ _ = hasNonIsolatedProperty2. $value. wrappedValue // Ok
504
+ }
461
505
462
506
// ----------------------------------------------------------------------
463
507
// Unsafe global actors
You can’t perform that action at this time.
0 commit comments