@@ -105,9 +105,8 @@ struct HasWrapperOnActor {
105105 @MainActor
106106 func testMA( ) { }
107107
108- // expected-error@+2{{calls to '@MainActor'-isolated' code in instance method 'testErrors()'}}
109108 // expected-note@+1{{add '@MainActor' to make instance method 'testErrors()' part of global actor 'MainActor'}}
110- func testErrors( ) {
109+ func testErrors( ) { // expected-error{{calls to '@MainActor'-isolated' code in instance method 'testErrors()'}}
111110 testMA ( ) // expected-error{{call to main actor-isolated instance method 'testMA()' in a synchronous nonisolated context}}
112111 }
113112}
@@ -117,9 +116,21 @@ class MainActorPreconcurrency {}
117116
118117class InferMainActorPreconcurrency : MainActorPreconcurrency {
119118 static func predatesConcurrency( ) { }
119+ func predatesConcurrency ( s: String ) -> String { return s }
120+ func predatesConcurrency ( n: Int ) -> Int { return n }
120121}
121122
122123nonisolated func testPreconcurrency( ) {
123124 InferMainActorPreconcurrency . predatesConcurrency ( )
124125 // expected-warning@-1 {{call to main actor-isolated static method 'predatesConcurrency()' in a synchronous nonisolated context}}
125126}
127+
128+ func testPreconcurrencyGrouped( ) { // expected-warning {{calls to '@MainActor'-isolated' code in global function 'testPreconcurrencyGrouped()'}}
129+ // expected-note@-1 {{add '@MainActor' to make global function 'testPreconcurrencyGrouped()' part of global actor 'MainActor'}}
130+ InferMainActorPreconcurrency . predatesConcurrency ( )
131+ // expected-note@-1 {{call to main actor-isolated static method 'predatesConcurrency()' in a synchronous nonisolated context}}
132+ let _ = InferMainActorPreconcurrency ( ) . predatesConcurrency ( s: " swift 6 " )
133+ // expected-note@-1 {{call to main actor-isolated instance method 'predatesConcurrency(s:)' in a synchronous nonisolated context}}
134+ let _ = InferMainActorPreconcurrency ( ) . predatesConcurrency ( n: 4 )
135+ // expected-note@-1 {{call to main actor-isolated instance method 'predatesConcurrency(n:)' in a synchronous nonisolated context}}
136+ }
0 commit comments