Skip to content

Commit c7dbc19

Browse files
committed
ConformanceChecker: Make actor_isolated_witness call out the protocol
1 parent b31b90d commit c7dbc19

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5659,9 +5659,10 @@ NOTE(shared_state_make_immutable,none,
56595659
NOTE(shared_state_nonisolated_unsafe,none,
56605660
"disable concurrency-safety checks if accesses are protected by an external synchronization mechanism", (const ValueDecl *))
56615661
ERROR(actor_isolated_witness,none,
5662-
"%select{|distributed }0%1 %kind2 cannot be used to satisfy %3 protocol "
5663-
"requirement",
5664-
(bool, ActorIsolation, const ValueDecl *, ActorIsolation))
5662+
"%select{|distributed }0%1 %kind2 cannot be used to satisfy %3 "
5663+
"requirement from protocol %base4",
5664+
(bool, ActorIsolation, const ValueDecl *, ActorIsolation,
5665+
const ValueDecl *))
56655666
ERROR(actor_cannot_conform_to_global_actor_protocol,none,
56665667
"actor %0 cannot conform to global actor isolated protocol %1",
56675668
(Type, Type))

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3444,10 +3444,12 @@ ConformanceChecker::checkActorIsolation(ValueDecl *requirement,
34443444

34453445
// Complain that this witness cannot conform to the requirement due to
34463446
// actor isolation.
3447-
witness->diagnose(diag::actor_isolated_witness,
3448-
isDistributed && !isDistributedDecl(witness),
3449-
refResult.isolation, witness, requirementIsolation)
3450-
.limitBehaviorUntilSwiftVersion(behavior, 6);
3447+
witness
3448+
->diagnose(diag::actor_isolated_witness,
3449+
isDistributed && !isDistributedDecl(witness),
3450+
refResult.isolation, witness, requirementIsolation,
3451+
Conformance->getProtocol())
3452+
.limitBehaviorUntilSwiftVersion(behavior, 6);
34513453

34523454
// If we need 'distributed' on the witness, add it.
34533455
if (missingOptions.contains(MissingFlags::WitnessDistributed)) {

0 commit comments

Comments
 (0)