@@ -482,11 +482,25 @@ struct InferRequirementsWalker : public TypeWalker {
482
482
}
483
483
484
484
Action walkToTypePost (Type ty) override {
485
+ // Skip `Sendable` conformance requirements that are inferred from
486
+ // `@preconcurrency` declarations.
487
+ auto skipRequirement = [](Requirement req, Decl *fromDecl) {
488
+ if (!fromDecl->preconcurrency ())
489
+ return false ;
490
+
491
+ return (req.getKind () == RequirementKind::Conformance &&
492
+ req.getSecondType ()->castTo <ProtocolType>()->getDecl ()
493
+ ->isSpecificProtocol (KnownProtocolKind::Sendable));
494
+ };
495
+
485
496
// Infer from generic typealiases.
486
497
if (auto typeAlias = dyn_cast<TypeAliasType>(ty.getPointer ())) {
487
498
auto decl = typeAlias->getDecl ();
488
499
auto subMap = typeAlias->getSubstitutionMap ();
489
500
for (const auto &rawReq : decl->getGenericSignature ().getRequirements ()) {
501
+ if (skipRequirement (rawReq, decl))
502
+ continue ;
503
+
490
504
desugarRequirement (rawReq.subst (subMap), SourceLoc (), reqs, errors);
491
505
}
492
506
@@ -567,6 +581,9 @@ struct InferRequirementsWalker : public TypeWalker {
567
581
// Handle the requirements.
568
582
// FIXME: Inaccurate TypeReprs.
569
583
for (const auto &rawReq : genericSig.getRequirements ()) {
584
+ if (skipRequirement (rawReq, decl))
585
+ continue ;
586
+
570
587
auto req = rawReq.subst (subMap);
571
588
desugarRequirement (req, SourceLoc (), reqs, errors);
572
589
}
0 commit comments