@@ -3524,6 +3524,7 @@ class ExprAvailabilityWalker : public ASTWalker {
35243524 ASTContext &Context;
35253525 MemberAccessContext AccessContext = MemberAccessContext::Default;
35263526 SmallVector<const Expr *, 16 > ExprStack;
3527+ SmallVector<bool , 4 > PreconcurrencyCalleeStack;
35273528 const ExportContext &Where;
35283529
35293530public:
@@ -3547,6 +3548,15 @@ class ExprAvailabilityWalker : public ASTWalker {
35473548
35483549 ExprStack.push_back (E);
35493550
3551+ if (auto *apply = dyn_cast<ApplyExpr>(E)) {
3552+ bool preconcurrency = false ;
3553+ auto declRef = apply->getFn ()->getReferencedDecl ();
3554+ if (auto *decl = declRef.getDecl ()) {
3555+ preconcurrency = decl->preconcurrency ();
3556+ }
3557+ PreconcurrencyCalleeStack.push_back (preconcurrency);
3558+ }
3559+
35503560 if (auto DR = dyn_cast<DeclRefExpr>(E)) {
35513561 diagnoseDeclRefAvailability (DR->getDeclRef (), DR->getSourceRange (),
35523562 getEnclosingApplyExpr (), std::nullopt );
@@ -3669,9 +3679,15 @@ class ExprAvailabilityWalker : public ASTWalker {
36693679 EE->getLoc (),
36703680 Where.getDeclContext ());
36713681
3682+ bool preconcurrency = false ;
3683+ if (!PreconcurrencyCalleeStack.empty ()) {
3684+ preconcurrency = PreconcurrencyCalleeStack.back ();
3685+ }
3686+
36723687 for (ProtocolConformanceRef C : EE->getConformances ()) {
36733688 diagnoseConformanceAvailability (E->getLoc (), C, Where, Type (), Type (),
3674- /* useConformanceAvailabilityErrorsOpt=*/ true );
3689+ /* useConformanceAvailabilityErrorsOpt=*/ true ,
3690+ /* preconcurrency=*/ preconcurrency);
36753691 }
36763692 }
36773693
@@ -3697,6 +3713,10 @@ class ExprAvailabilityWalker : public ASTWalker {
36973713 assert (ExprStack.back () == E);
36983714 ExprStack.pop_back ();
36993715
3716+ if (auto *apply = dyn_cast<ApplyExpr>(E)) {
3717+ PreconcurrencyCalleeStack.pop_back ();
3718+ }
3719+
37003720 return Action::Continue (E);
37013721 }
37023722
0 commit comments