Skip to content

Commit d6e7ca8

Browse files
authored
Merge pull request swiftlang#38571 from DougGregor/concurrency-lib-without-availability
Disable async availability checking for swift_deletedAsyncMethodError.
2 parents 05e6410 + d2331f5 commit d6e7ca8

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/Sema/TypeCheckDeclPrimary.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2676,6 +2676,13 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
26762676
return AFD->getResilienceExpansion() != ResilienceExpansion::Minimal;
26772677
}
26782678

2679+
/// FIXME: This is an egregious hack to turn off availability checking
2680+
/// for specific functions that were missing availability in older versions
2681+
/// of existing libraries that we must nonethess still support.
2682+
static bool hasHistoricallyWrongAvailability(FuncDecl *func) {
2683+
return func->getName().isCompoundName("swift_deletedAsyncMethodError", { });
2684+
}
2685+
26792686
void visitFuncDecl(FuncDecl *FD) {
26802687
// Force these requests in case they emit diagnostics.
26812688
(void) FD->getInterfaceType();
@@ -2721,7 +2728,8 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
27212728

27222729
checkImplementationOnlyOverride(FD);
27232730

2724-
if (FD->getAsyncLoc().isValid())
2731+
if (FD->getAsyncLoc().isValid() &&
2732+
!hasHistoricallyWrongAvailability(FD))
27252733
TypeChecker::checkConcurrencyAvailability(FD->getAsyncLoc(), FD);
27262734

27272735
if (requiresDefinition(FD) && !FD->hasBody()) {

test/Concurrency/concurrency_availability.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ func f() async { } // expected-error{{concurrency is only available in}}
77

88
actor A { } // expected-error{{concurrency is only available in}}
99
// expected-note@-1{{add @available}}
10+
11+
// Allow this without any availability for Historical Reasons.
12+
public func swift_deletedAsyncMethodError() async {
13+
}

0 commit comments

Comments
 (0)