@@ -3365,18 +3365,21 @@ namespace {
3365
3365
}
3366
3366
}
3367
3367
3368
- // Captured values in a path component must conform to Sendable.
3369
- // These captured values appear in Subscript, such as \Type.dict[k]
3370
- // where k is a captured dictionary key.
3371
- if (auto *args = component.getSubscriptArgs ()) {
3372
- for (auto arg : *args) {
3373
- auto type = getType (arg.getExpr ());
3374
- if (type &&
3375
- shouldDiagnoseExistingDataRaces (getDeclContext ()) &&
3376
- diagnoseNonSendableTypes (
3377
- type, getDeclContext (), component.getLoc (),
3378
- diag::non_sendable_keypath_capture))
3379
- diagnosed = true ;
3368
+ // With `InferSendableFromCaptures` feature enabled the solver is
3369
+ // responsible for inferring `& Sendable` for sendable key paths.
3370
+ if (!ctx.LangOpts .hasFeature (Feature::InferSendableFromCaptures)) {
3371
+ // Captured values in a path component must conform to Sendable.
3372
+ // These captured values appear in Subscript, such as \Type.dict[k]
3373
+ // where k is a captured dictionary key.
3374
+ if (auto *args = component.getSubscriptArgs ()) {
3375
+ for (auto arg : *args) {
3376
+ auto type = getType (arg.getExpr ());
3377
+ if (type && shouldDiagnoseExistingDataRaces (getDeclContext ()) &&
3378
+ diagnoseNonSendableTypes (type, getDeclContext (),
3379
+ component.getLoc (),
3380
+ diag::non_sendable_keypath_capture))
3381
+ diagnosed = true ;
3382
+ }
3380
3383
}
3381
3384
}
3382
3385
}
0 commit comments