@@ -105,9 +105,8 @@ struct HasWrapperOnActor {
105
105
@MainActor
106
106
func testMA( ) { }
107
107
108
- // expected-error@+2{{calls to '@MainActor'-isolated' code in instance method 'testErrors()'}}
109
108
// 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()'}}
111
110
testMA ( ) // expected-error{{call to main actor-isolated instance method 'testMA()' in a synchronous nonisolated context}}
112
111
}
113
112
}
@@ -117,9 +116,21 @@ class MainActorPreconcurrency {}
117
116
118
117
class InferMainActorPreconcurrency : MainActorPreconcurrency {
119
118
static func predatesConcurrency( ) { }
119
+ func predatesConcurrency ( s: String ) -> String { return s }
120
+ func predatesConcurrency ( n: Int ) -> Int { return n }
120
121
}
121
122
122
123
nonisolated func testPreconcurrency( ) {
123
124
InferMainActorPreconcurrency . predatesConcurrency ( )
124
125
// expected-warning@-1 {{call to main actor-isolated static method 'predatesConcurrency()' in a synchronous nonisolated context}}
125
126
}
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