@@ -1448,7 +1448,7 @@ class UsableFromInlineChecker : public AccessControlCheckerBase,
14481448// / Local variant to swift::getDisallowedOriginKind for downgrade to warnings.
14491449DisallowedOriginKind
14501450swift::getDisallowedOriginKind (const Decl *decl,
1451- ExportContext where,
1451+ const ExportContext & where,
14521452 DowngradeToWarning &downgradeToWarning) {
14531453 downgradeToWarning = DowngradeToWarning::No;
14541454 ModuleDecl *M = decl->getModuleContext ();
@@ -1496,11 +1496,7 @@ class DeclAvailabilityChecker : public DeclVisitor<DeclAvailabilityChecker> {
14961496 if (allowUnavailableProtocol)
14971497 flags |= DeclAvailabilityFlag::AllowPotentiallyUnavailableProtocol;
14981498
1499- auto loc = context->getLoc ();
1500- if (auto *varDecl = dyn_cast<VarDecl>(context))
1501- loc = varDecl->getNameLoc ();
1502-
1503- diagnoseTypeAvailability (typeRepr, type, loc,
1499+ diagnoseTypeAvailability (typeRepr, type, context->getLoc (),
15041500 Where.withReason (reason), flags);
15051501 }
15061502
@@ -1595,10 +1591,18 @@ class DeclAvailabilityChecker : public DeclVisitor<DeclAvailabilityChecker> {
15951591 TP->getTypeRepr (), anyVar ? (Decl *)anyVar : (Decl *)PBD);
15961592
15971593 // Check the property wrapper types.
1598- if (anyVar)
1599- for (auto attr : anyVar->getAttachedPropertyWrappers ())
1594+ if (anyVar) {
1595+ for (auto attr : anyVar->getAttachedPropertyWrappers ()) {
16001596 checkType (attr->getType (), attr->getTypeRepr (), anyVar,
16011597 ExportabilityReason::PropertyWrapper);
1598+ }
1599+
1600+ if (auto attr = anyVar->getAttachedResultBuilder ()) {
1601+ checkType (anyVar->getResultBuilderType (),
1602+ attr->getTypeRepr (), anyVar,
1603+ ExportabilityReason::ResultBuilder);
1604+ }
1605+ }
16021606 }
16031607
16041608 void visitPatternBindingDecl (PatternBindingDecl *PBD) {
@@ -1687,6 +1691,12 @@ class DeclAvailabilityChecker : public DeclVisitor<DeclAvailabilityChecker> {
16871691 void visitFuncDecl (FuncDecl *FD) {
16881692 visitAbstractFunctionDecl (FD);
16891693 checkType (FD->getResultInterfaceType (), FD->getResultTypeRepr (), FD);
1694+
1695+ if (auto attr = FD->getAttachedResultBuilder ()) {
1696+ checkType (FD->getResultBuilderType (),
1697+ attr->getTypeRepr (), FD,
1698+ ExportabilityReason::ResultBuilder);
1699+ }
16901700 }
16911701
16921702 void visitEnumElementDecl (EnumElementDecl *EED) {
@@ -1830,7 +1840,7 @@ static void checkExtensionGenericParamAccess(const ExtensionDecl *ED) {
18301840}
18311841
18321842DisallowedOriginKind swift::getDisallowedOriginKind (const Decl *decl,
1833- ExportContext where) {
1843+ const ExportContext & where) {
18341844 auto downgradeToWarning = DowngradeToWarning::No;
18351845 return getDisallowedOriginKind (decl, where, downgradeToWarning);
18361846}
0 commit comments