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 {
20802080 // Add Fix-it for missing @SomeActor annotation
20812081 if (isolation.isGlobalActor ()) {
20822082 if (missingGlobalActorOnContext (
2083- const_cast <DeclContext*>(getDeclContext ()), isolation.getGlobalActor (), behavior)) {
2083+ const_cast <DeclContext *>(getDeclContext ()),
2084+ isolation.getGlobalActor (), behavior) &&
2085+ errors.size () > 1 ) {
20842086 behavior= DiagnosticBehavior::Note;
20852087 }
20862088 }
@@ -2103,7 +2105,9 @@ namespace {
21032105 // Add Fix-it for missing @SomeActor annotation
21042106 if (isolation.isGlobalActor ()) {
21052107 if (missingGlobalActorOnContext (
2106- const_cast <DeclContext*>(getDeclContext ()), isolation.getGlobalActor (), behavior)) {
2108+ const_cast <DeclContext *>(getDeclContext ()),
2109+ isolation.getGlobalActor (), behavior) &&
2110+ errors.size () > 1 ) {
21072111 behavior= DiagnosticBehavior::Note;
21082112 }
21092113 }
Original file line number Diff line number Diff line change 11// RUN: %target-typecheck-verify-swift -disable-availability-checking -enable-experimental-feature GroupActorErrors
22// REQUIRES: concurrency
33
4-
54@MainActor
65protocol P {
76 func f( )
@@ -14,7 +13,7 @@ struct S_P: P {
1413 func g( ) { }
1514}
1615
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'}}
1817 p. f ( ) // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
1918 p. f ( ) // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
2019 p. f ( ) // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
@@ -71,7 +70,6 @@ struct HasWrapperOnActor {
7170 func testMA( ) { }
7271
7372 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}}
7674 }
7775}
You can’t perform that action at this time.
0 commit comments