@@ -1670,72 +1670,6 @@ SelfAccessKindRequest::evaluate(Evaluator &evaluator, FuncDecl *FD) const {
1670
1670
return SelfAccessKind::NonMutating;
1671
1671
}
1672
1672
1673
- bool TypeChecker::isAvailabilitySafeForConformance (
1674
- const ProtocolDecl *proto, const ValueDecl *requirement,
1675
- const ValueDecl *witness, const DeclContext *dc,
1676
- AvailabilityRange &requirementInfo) {
1677
-
1678
- // We assume conformances in
1679
- // non-SourceFiles have already been checked for availability.
1680
- if (!dc->getParentSourceFile ())
1681
- return true ;
1682
-
1683
- auto &Context = proto->getASTContext ();
1684
- assert (dc->getSelfNominalTypeDecl () &&
1685
- " Must have a nominal or extension context" );
1686
-
1687
- auto contextForConformingDecl =
1688
- AvailabilityContext::forDeclSignature (dc->getAsDecl ());
1689
-
1690
- // If the conformance is unavailable then it's irrelevant whether the witness
1691
- // is potentially unavailable.
1692
- if (contextForConformingDecl.isUnavailable ())
1693
- return true ;
1694
-
1695
- // Make sure that any access of the witness through the protocol
1696
- // can only occur when the witness is available. That is, make sure that
1697
- // on every version where the conforming declaration is available, if the
1698
- // requirement is available then the witness is available as well.
1699
- // We do this by checking that (an over-approximation of) the intersection of
1700
- // the requirement's available range with both the conforming declaration's
1701
- // available range and the protocol's available range is fully contained in
1702
- // (an over-approximation of) the intersection of the witnesses's available
1703
- // range with both the conforming type's available range and the protocol
1704
- // declaration's available range.
1705
- AvailabilityRange witnessInfo =
1706
- AvailabilityInference::availableRange (witness);
1707
- requirementInfo = AvailabilityInference::availableRange (requirement);
1708
-
1709
- AvailabilityRange infoForConformingDecl =
1710
- contextForConformingDecl.getPlatformRange ();
1711
-
1712
- // Relax the requirements for @_spi witnesses by treating the requirement as
1713
- // if it were introduced at the deployment target. This is not strictly sound
1714
- // since clients of SPI do not necessarily have the same deployment target as
1715
- // the module declaring the requirement. However, now that the public
1716
- // declarations in API libraries are checked according to the minimum possible
1717
- // deployment target of their clients this relaxation is needed for source
1718
- // compatibility with some existing code and is reasonably safe for the
1719
- // majority of cases.
1720
- if (witness->isSPI ()) {
1721
- AvailabilityRange deploymentTarget =
1722
- AvailabilityRange::forDeploymentTarget (Context);
1723
- requirementInfo.constrainWith (deploymentTarget);
1724
- }
1725
-
1726
- // Constrain over-approximates intersection of version ranges.
1727
- witnessInfo.constrainWith (infoForConformingDecl);
1728
- requirementInfo.constrainWith (infoForConformingDecl);
1729
-
1730
- AvailabilityRange infoForProtocolDecl =
1731
- AvailabilityContext::forDeclSignature (proto).getPlatformRange ();
1732
-
1733
- witnessInfo.constrainWith (infoForProtocolDecl);
1734
- requirementInfo.constrainWith (infoForProtocolDecl);
1735
-
1736
- return requirementInfo.isContainedIn (witnessInfo);
1737
- }
1738
-
1739
1673
// Returns 'nullptr' if this is the 'newValue' or 'oldValue' parameter;
1740
1674
// otherwise, returns the corresponding parameter of the subscript
1741
1675
// declaration.
0 commit comments