|
1 | 1 | // RUN: %empty-directory(%t) |
2 | 2 |
|
3 | 3 | // RUN: %target-swift-frontend -emit-module -emit-module-path %t/other_global_actor_inference.swiftmodule -module-name other_global_actor_inference -strict-concurrency=complete %S/Inputs/other_global_actor_inference.swift |
4 | | -// RUN: %target-swift-frontend -I %t -disable-availability-checking %s -emit-sil -o /dev/null -verify |
5 | | -// RUN: %target-swift-frontend -I %t -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted |
| 4 | +// RUN: %target-swift-frontend -I %t -disable-availability-checking %s -emit-sil -o /dev/null -verify -verify-additional-prefix minimal-targeted- |
| 5 | +// RUN: %target-swift-frontend -I %t -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted -verify-additional-prefix minimal-targeted- |
6 | 6 | // RUN: %target-swift-frontend -I %t -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -verify-additional-prefix complete-tns- |
7 | 7 | // RUN: %target-swift-frontend -I %t -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -enable-experimental-feature RegionBasedIsolation -verify-additional-prefix complete-tns- |
8 | 8 |
|
@@ -437,13 +437,15 @@ actor WrapperActorBad2<Wrapped: Sendable> { |
437 | 437 | struct WrapperWithMainActorDefaultInit { |
438 | 438 | var wrappedValue: Int { fatalError() } |
439 | 439 |
|
440 | | - @MainActor init() {} // expected-note 2 {{calls to initializer 'init()' from outside of its actor context are implicitly asynchronous}} |
| 440 | + @MainActor init() {} // expected-note {{calls to initializer 'init()' from outside of its actor context are implicitly asynchronous}} |
| 441 | + // expected-minimal-targeted-note@-1 {{calls to initializer 'init()' from outside of its actor context are implicitly asynchronous}} |
441 | 442 | } |
442 | 443 |
|
443 | 444 | actor ActorWithWrapper { |
444 | 445 | @WrapperOnActor var synced: Int = 0 |
445 | 446 | // expected-note@-1 3{{property declared here}} |
446 | | - @WrapperWithMainActorDefaultInit var property: Int // expected-error {{call to main actor-isolated initializer 'init()' in a synchronous actor-isolated context}} |
| 447 | + @WrapperWithMainActorDefaultInit var property: Int // expected-minimal-targeted-error {{call to main actor-isolated initializer 'init()' in a synchronous actor-isolated context}} |
| 448 | + // expected-complete-tns-error@-1 {{main actor-isolated default value in a actor-isolated context}} |
447 | 449 | func f() { |
448 | 450 | _ = synced // expected-error{{main actor-isolated property 'synced' can not be referenced on a different actor instance}} |
449 | 451 | _ = $synced // expected-error{{global actor 'SomeGlobalActor'-isolated property '$synced' can not be referenced on a different actor instance}} |
@@ -557,8 +559,9 @@ struct WrapperOnUnsafeActor<Wrapped> { |
557 | 559 | } |
558 | 560 | } |
559 | 561 |
|
| 562 | +// HasWrapperOnUnsafeActor gets an inferred @MainActor attribute. |
560 | 563 | struct HasWrapperOnUnsafeActor { |
561 | | - @WrapperOnUnsafeActor var synced: Int = 0 |
| 564 | + @WrapperOnUnsafeActor var synced: Int = 0 // expected-complete-tns-error {{global actor 'OtherGlobalActor'-isolated default value in a main actor-isolated context}} |
562 | 565 | // expected-note @-1 3{{property declared here}} |
563 | 566 | // expected-complete-tns-note @-2 3{{property declared here}} |
564 | 567 |
|
@@ -643,11 +646,11 @@ func acceptAsyncSendableClosureInheriting<T>(@_inheritActorContext _: @Sendable |
643 | 646 |
|
644 | 647 | // defer bodies inherit global actor-ness |
645 | 648 | @MainActor |
646 | | -var statefulThingy: Bool = false // expected-note {{var declared here}} |
| 649 | +var statefulThingy: Bool = false // expected-minimal-targeted-note {{var declared here}} |
647 | 650 | // expected-complete-tns-error @-1 {{top-level code variables cannot have a global actor}} |
648 | 651 |
|
649 | 652 | @MainActor |
650 | | -func useFooInADefer() -> String { // expected-note {{calls to global function 'useFooInADefer()' from outside of its actor context are implicitly asynchronous}} |
| 653 | +func useFooInADefer() -> String { // expected-minimal-targeted-note {{calls to global function 'useFooInADefer()' from outside of its actor context are implicitly asynchronous}} |
651 | 654 | defer { |
652 | 655 | statefulThingy = true |
653 | 656 | } |
@@ -677,9 +680,11 @@ class Cutter { |
677 | 680 |
|
678 | 681 | @SomeGlobalActor |
679 | 682 | class Butter { |
680 | | - var a = useFooInADefer() // expected-error {{call to main actor-isolated global function 'useFooInADefer()' in a synchronous global actor 'SomeGlobalActor'-isolated context}} |
| 683 | + var a = useFooInADefer() // expected-minimal-targeted-error {{call to main actor-isolated global function 'useFooInADefer()' in a synchronous global actor 'SomeGlobalActor'-isolated context}} |
| 684 | + // expected-complete-tns-error@-1 {{main actor-isolated default value in a global actor 'SomeGlobalActor'-isolated context}} |
681 | 685 |
|
682 | | - nonisolated let b = statefulThingy // expected-error {{main actor-isolated var 'statefulThingy' can not be referenced from a non-isolated context}} |
| 686 | + nonisolated let b = statefulThingy // expected-minimal-targeted-error {{main actor-isolated var 'statefulThingy' can not be referenced from a non-isolated context}} |
| 687 | + // expected-complete-tns-error@-1 {{main actor-isolated default value in a nonisolated context}} |
683 | 688 |
|
684 | 689 | var c: Int = { |
685 | 690 | return getGlobal7() |
|
0 commit comments