Skip to content

Commit afaec90

Browse files
committed
---
yaml --- r: 349488 b: refs/heads/master-next c: a823104 h: refs/heads/master
1 parent 6bc07e4 commit afaec90

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: 39821adf5af9b3d8d8806e520cefb6bf9dfd4e1d
3+
refs/heads/master-next: a8231043f401c005c7ae877a43fd25a36b55c306
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/lib/Sema/TypeCheckAvailability.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2838,7 +2838,9 @@ void swift::checkExplicitAvailability(Decl *decl) {
28382838
// Warn on decls without an introduction version.
28392839
auto &ctx = decl->getASTContext();
28402840
auto safeRangeUnderApprox = AvailabilityInference::availableRange(decl, ctx);
2841-
if (!safeRangeUnderApprox.getOSVersion().hasLowerEndpoint()) {
2841+
if (!safeRangeUnderApprox.getOSVersion().hasLowerEndpoint() &&
2842+
!decl->getAttrs().isUnavailable(ctx)) {
2843+
28422844
auto diag = decl->diagnose(diag::public_decl_needs_availability);
28432845

28442846
auto suggestPlatform = decl->getASTContext().LangOpts.RequireExplicitAvailabilityTarget;

branches/master-next/test/attr/require_explicit_availability.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ func bar() { } // expected-warning {{public declarations should have an availabi
1313
@available(macOS 10.1, *)
1414
public func ok() { }
1515

16+
@available(macOS, unavailable)
17+
public func unavailableOk() { }
18+
1619
@available(macOS, deprecated: 10.10)
1720
public func missingIntro() { } // expected-warning {{public declarations should have an availability attribute with -require-explicit-availability}} {{1-1=@available(macOS 10.10, *)\n}}
1821

22+
@available(iOS 9.0, *)
23+
public func missingTargetPlatform() { } // expected-warning {{public declarations should have an availability attribute with -require-explicit-availability}} {{1-1=@available(macOS 10.10, *)\n}}
24+
1925
func privateFunc() { }
2026

2127
@_alwaysEmitIntoClient

0 commit comments

Comments
 (0)