Skip to content

Commit 93d4fa5

Browse files
authored
Merge pull request swiftlang#63177 from tshortli/avoid-more-available-diagnostic-in-swift-interface
Sema: Avoid diagnosing over-availability in swiftinterfaces
2 parents 9ac8ed6 + 6f721ae commit 93d4fa5

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,11 @@ void AttributeChecker::visitAvailableAttr(AvailableAttr *attr) {
18631863

18641864
}
18651865

1866+
// Skip the remaining diagnostics in swiftinterfaces.
1867+
auto *SF = D->getDeclContext()->getParentSourceFile();
1868+
if (SF && SF->Kind == SourceFileKind::Interface)
1869+
return;
1870+
18661871
if (!attr->hasPlatform() || !attr->isActivePlatform(Ctx) ||
18671872
!attr->Introduced.has_value()) {
18681873
return;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// swift-interface-format-version: 1.0
2+
// swift-module-flags:
3+
4+
// RUN: %target-swift-typecheck-module-from-interface(%s) -module-name Foo
5+
// REQUIRES: VENDOR=apple
6+
7+
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
8+
public struct S {
9+
// This declaration is more available than its container but we don't want to
10+
// diagnose that in a .swiftinterface since it may be the result of code
11+
// synthesis and the client of the module can't do anything about it.
12+
@available(macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, *)
13+
public func moreAvailable()
14+
}

0 commit comments

Comments
 (0)