Sema: Avoid diagnosing over-availability in swiftinterfaces.

Resolves rdar://104576016
This commit is contained in:
Allan Shortlidge
2023-01-23 18:33:23 -08:00
parent eecde02dde
commit 6f721ae8e0
2 changed files with 19 additions and 0 deletions

View File

@@ -1863,6 +1863,11 @@ void AttributeChecker::visitAvailableAttr(AvailableAttr *attr) {
}
// Skip the remaining diagnostics in swiftinterfaces.
auto *SF = D->getDeclContext()->getParentSourceFile();
if (SF && SF->Kind == SourceFileKind::Interface)
return;
if (!attr->hasPlatform() || !attr->isActivePlatform(Ctx) ||
!attr->Introduced.has_value()) {
return;

View File

@@ -0,0 +1,14 @@
// swift-interface-format-version: 1.0
// swift-module-flags:
// RUN: %target-swift-typecheck-module-from-interface(%s) -module-name Foo
// REQUIRES: VENDOR=apple
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
public struct S {
// This declaration is more available than its container but we don't want to
// diagnose that in a .swiftinterface since it may be the result of code
// synthesis and the client of the module can't do anything about it.
@available(macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, *)
public func moreAvailable()
}