File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -2080,7 +2080,9 @@ namespace {
2080
2080
// Add Fix-it for missing @SomeActor annotation
2081
2081
if (isolation.isGlobalActor ()) {
2082
2082
if (missingGlobalActorOnContext (
2083
- const_cast <DeclContext*>(getDeclContext ()), isolation.getGlobalActor (), behavior)) {
2083
+ const_cast <DeclContext *>(getDeclContext ()),
2084
+ isolation.getGlobalActor (), behavior) &&
2085
+ errors.size () > 1 ) {
2084
2086
behavior= DiagnosticBehavior::Note;
2085
2087
}
2086
2088
}
@@ -2103,7 +2105,9 @@ namespace {
2103
2105
// Add Fix-it for missing @SomeActor annotation
2104
2106
if (isolation.isGlobalActor ()) {
2105
2107
if (missingGlobalActorOnContext (
2106
- const_cast <DeclContext*>(getDeclContext ()), isolation.getGlobalActor (), behavior)) {
2108
+ const_cast <DeclContext *>(getDeclContext ()),
2109
+ isolation.getGlobalActor (), behavior) &&
2110
+ errors.size () > 1 ) {
2107
2111
behavior= DiagnosticBehavior::Note;
2108
2112
}
2109
2113
}
Original file line number Diff line number Diff line change 1
1
// RUN: %target-typecheck-verify-swift -disable-availability-checking -enable-experimental-feature GroupActorErrors
2
2
// REQUIRES: concurrency
3
3
4
-
5
4
@MainActor
6
5
protocol P {
7
6
func f( )
@@ -14,7 +13,7 @@ struct S_P: P {
14
13
func g( ) { }
15
14
}
16
15
17
- func testP2 ( x: S_P , p: P ) { // expected-error{{add '@MainActor' to make global function 'testP2 (x:p:)' part of global actor 'MainActor'}}
16
+ func testP ( x: S_P , p: P ) { // expected-error{{add '@MainActor' to make global function 'testP (x:p:)' part of global actor 'MainActor'}}
18
17
p. f ( ) // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
19
18
p. f ( ) // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
20
19
p. f ( ) // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
@@ -71,7 +70,6 @@ struct HasWrapperOnActor {
71
70
func testMA( ) { }
72
71
73
72
func testErrors( ) { // expected-error{{add '@MainActor' to make instance method 'testErrors()' part of global actor 'MainActor'}}
74
- testMA ( ) // expected-note{{call to main actor-isolated instance method 'testMA()' in a synchronous nonisolated context}}
75
- testMA ( ) // expected-note{{call to main actor-isolated instance method 'testMA()' in a synchronous nonisolated context}}
73
+ testMA ( ) // expected-error{{call to main actor-isolated instance method 'testMA()' in a synchronous nonisolated context}}
76
74
}
77
75
}
You can’t perform that action at this time.
0 commit comments