ModuleInterface: Handle more synthesized conformance availability corner cases.

As a follow up to https://github.com/swiftlang/swift/pull/87832, continue
adjusting the algorithm for computing synthesized conformance availability.
When an outer declaration is `unavailable` in a more specific platform domain
and the inner declaration is `introduced:` in a less specific domain, the inner
declaration attribute does not override the outer declaration attribute.
Unavailability and introduction on separate axes of availability.

Resolves rdar://173724423.
This commit is contained in:
Allan Shortlidge
2026-03-30 17:37:36 -07:00
parent b00783ef26
commit 102581b597
2 changed files with 27 additions and 2 deletions
+5 -2
View File
@@ -458,11 +458,14 @@ class InheritedProtocolCollector {
for (auto nextAttr : D->getSemanticAvailableAttrs()) {
// FIXME: This is just approximating the effects of nested availability
// attributes for the same platform; formally they'd need to be merged.
bool alreadyHasMoreSpecificAttrForThisPlatform = llvm::any_of(
bool alreadyHasActiveAttrForDomain = llvm::any_of(
*cache, [nextAttr](SemanticAvailableAttr existingAttr) {
if (nextAttr.getParsedAttr()->getKind() !=
existingAttr.getParsedAttr()->getKind())
return false;
return existingAttr.getDomain().contains(nextAttr.getDomain());
});
if (alreadyHasMoreSpecificAttrForThisPlatform)
if (alreadyHasActiveAttrForDomain)
continue;
pendingAttrs.push_back(nextAttr);
}