mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: Avoid diagnosing over-availability in swiftinterfaces.
Resolves rdar://104576016
This commit is contained in:
@@ -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;
|
||||
|
||||
14
test/ModuleInterface/availability-diagnostics.swiftinterface
Normal file
14
test/ModuleInterface/availability-diagnostics.swiftinterface
Normal 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()
|
||||
}
|
||||
Reference in New Issue
Block a user