Skip to content

Commit cbcaff4

Browse files
authored
Merge pull request #41078 from DougGregor/concurrency-diag-conformance-context-5.6
Determine concurrency diagnostic behavior based on conformance context.
2 parents 2c719cc + cb1e59d commit cbcaff4

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2905,7 +2905,7 @@ bool ConformanceChecker::checkActorIsolation(
29052905
bool isCrossActor = false;
29062906
bool witnessIsUnsafe = false;
29072907
DiagnosticBehavior behavior = SendableCheckContext(
2908-
witness->getInnermostDeclContext()).defaultDiagnosticBehavior();
2908+
Conformance->getDeclContext()).defaultDiagnosticBehavior();
29092909
Type witnessGlobalActor;
29102910
switch (auto witnessRestriction =
29112911
ActorIsolationRestriction::forDeclaration(

test/Concurrency/actor_isolation_unsafe.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@ struct S3_P1: P1 {
2929
nonisolated func onMainActor() { }
3030
}
3131

32+
struct S4_P1_quietly: P1 {
33+
@SomeGlobalActor func onMainActor() { }
34+
}
35+
36+
@SomeGlobalActor
3237
struct S4_P1: P1 {
3338
@SomeGlobalActor func onMainActor() { } // expected-warning{{instance method 'onMainActor()' isolated to global actor 'SomeGlobalActor' can not satisfy corresponding requirement from protocol 'P1' isolated to global actor 'MainActor'}}
3439
}
3540

41+
3642
@MainActor(unsafe)
3743
protocol P2 {
3844
func f() // expected-note{{calls to instance method 'f()' from outside of its actor context are implicitly asynchronous}}

test/decl/class/actor/global_actor_conformance.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -disable-availability-checking
1+
// RUN: %target-typecheck-verify-swift -disable-availability-checking -warn-concurrency
22
// REQUIRES: concurrency
33

44
actor SomeActor { }

0 commit comments

Comments
 (0)