Sema: Replace TypeChecker::checkDeclarationAvailability().

Adopt `getUnmetDeclAvailabilityRequirement()` instead.
This commit is contained in:
Allan Shortlidge
2024-11-03 11:09:10 -08:00
parent 0377ef4afd
commit 7b5757b29b
6 changed files with 12 additions and 23 deletions

View File

@@ -4897,12 +4897,12 @@ bool ConstraintSystem::isReadOnlyKeyPathComponent(
// If the setter is unavailable, then the keypath ought to be read-only
// in this context.
if (auto setter = storage->getOpaqueAccessor(AccessorKind::Set)) {
ExportContext where = ExportContext::forFunctionBody(DC, referenceLoc);
auto maybeUnavail =
TypeChecker::checkDeclarationAvailability(setter, where);
if (maybeUnavail.has_value()) {
// FIXME: Fully unavailable setters should cause the key path to be
// readonly too.
auto unmetRequirement =
getUnmetDeclAvailabilityRequirement(setter, DC, referenceLoc);
if (unmetRequirement && unmetRequirement->isConditionallySatisfiable())
return true;
}
}
return false;