@@ -1448,7 +1448,7 @@ class UsableFromInlineChecker : public AccessControlCheckerBase,
1448
1448
// / Local variant to swift::getDisallowedOriginKind for downgrade to warnings.
1449
1449
DisallowedOriginKind
1450
1450
swift::getDisallowedOriginKind (const Decl *decl,
1451
- ExportContext where,
1451
+ const ExportContext & where,
1452
1452
DowngradeToWarning &downgradeToWarning) {
1453
1453
downgradeToWarning = DowngradeToWarning::No;
1454
1454
ModuleDecl *M = decl->getModuleContext ();
@@ -1496,11 +1496,7 @@ class DeclAvailabilityChecker : public DeclVisitor<DeclAvailabilityChecker> {
1496
1496
if (allowUnavailableProtocol)
1497
1497
flags |= DeclAvailabilityFlag::AllowPotentiallyUnavailableProtocol;
1498
1498
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 (),
1504
1500
Where.withReason (reason), flags);
1505
1501
}
1506
1502
@@ -1595,10 +1591,18 @@ class DeclAvailabilityChecker : public DeclVisitor<DeclAvailabilityChecker> {
1595
1591
TP->getTypeRepr (), anyVar ? (Decl *)anyVar : (Decl *)PBD);
1596
1592
1597
1593
// Check the property wrapper types.
1598
- if (anyVar)
1599
- for (auto attr : anyVar->getAttachedPropertyWrappers ())
1594
+ if (anyVar) {
1595
+ for (auto attr : anyVar->getAttachedPropertyWrappers ()) {
1600
1596
checkType (attr->getType (), attr->getTypeRepr (), anyVar,
1601
1597
ExportabilityReason::PropertyWrapper);
1598
+ }
1599
+
1600
+ if (auto attr = anyVar->getAttachedResultBuilder ()) {
1601
+ checkType (anyVar->getResultBuilderType (),
1602
+ attr->getTypeRepr (), anyVar,
1603
+ ExportabilityReason::ResultBuilder);
1604
+ }
1605
+ }
1602
1606
}
1603
1607
1604
1608
void visitPatternBindingDecl (PatternBindingDecl *PBD) {
@@ -1687,6 +1691,12 @@ class DeclAvailabilityChecker : public DeclVisitor<DeclAvailabilityChecker> {
1687
1691
void visitFuncDecl (FuncDecl *FD) {
1688
1692
visitAbstractFunctionDecl (FD);
1689
1693
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
+ }
1690
1700
}
1691
1701
1692
1702
void visitEnumElementDecl (EnumElementDecl *EED) {
@@ -1830,7 +1840,7 @@ static void checkExtensionGenericParamAccess(const ExtensionDecl *ED) {
1830
1840
}
1831
1841
1832
1842
DisallowedOriginKind swift::getDisallowedOriginKind (const Decl *decl,
1833
- ExportContext where) {
1843
+ const ExportContext & where) {
1834
1844
auto downgradeToWarning = DowngradeToWarning::No;
1835
1845
return getDisallowedOriginKind (decl, where, downgradeToWarning);
1836
1846
}
0 commit comments