@@ -2864,6 +2864,17 @@ static void emitDeclaredHereIfNeeded(DiagnosticEngine &diags,
2864
2864
2865
2865
bool ConformanceChecker::checkActorIsolation (
2866
2866
ValueDecl *requirement, ValueDecl *witness) {
2867
+ // / Retrieve a concrete witness for Sendable checking.
2868
+ auto getConcreteWitness = [&] {
2869
+ if (auto genericEnv = witness->getInnermostDeclContext ()
2870
+ ->getGenericEnvironmentOfContext ()) {
2871
+ return ConcreteDeclRef (
2872
+ witness, genericEnv->getForwardingSubstitutionMap ());
2873
+ }
2874
+
2875
+ return ConcreteDeclRef (witness);
2876
+ };
2877
+
2867
2878
// Ensure that the witness is not actor-isolated in a manner that makes it
2868
2879
// unsuitable as a witness.
2869
2880
bool isCrossActor = false ;
@@ -3014,8 +3025,8 @@ bool ConformanceChecker::checkActorIsolation(
3014
3025
3015
3026
case ActorIsolationRestriction::CrossActorSelf: {
3016
3027
if (diagnoseNonSendableTypesInReference (
3017
- witness , DC, witness->getLoc (),
3018
- ConcurrentReferenceKind::CrossActor)) {
3028
+ getConcreteWitness () , DC, witness->getLoc (),
3029
+ ConcurrentReferenceKind::CrossActor)) {
3019
3030
return true ;
3020
3031
}
3021
3032
@@ -3145,8 +3156,8 @@ bool ConformanceChecker::checkActorIsolation(
3145
3156
return false ;
3146
3157
3147
3158
return diagnoseNonSendableTypesInReference (
3148
- witness , DC, witness->getLoc (),
3149
- ConcurrentReferenceKind::CrossActor);
3159
+ getConcreteWitness () , DC, witness->getLoc (),
3160
+ ConcurrentReferenceKind::CrossActor);
3150
3161
}
3151
3162
3152
3163
// If the witness has a global actor but the requirement does not, we have
0 commit comments