Skip to content

Commit 8f61ec2

Browse files
committed
Sema: Don't diagnose isolated deinit availability in skipped function bodies.
As a follow-up fix for #83545, avoid incorrectly diagnosing isolated deinit availability during module emission jobs, which skip type checking non-inlinable function bodies and therefore don't build accurate availability scopes for those bodies. It's ok to skip these diagnostics during module emission since they should still be emitted during compilation jobs. Resolves rdar://161178785.
1 parent 9016636 commit 8f61ec2

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
133133
}
134134

135135
if (!getActorIsolation(nominal).isMainActor() && destructor->hasBody()) {
136+
// In module emission jobs, type checking the body of the destructor may
137+
// be skipped which means availability in the body cannot be diagnosed
138+
// accurately.
139+
if (destructor->isBodySkipped())
140+
return;
141+
136142
TypeChecker::checkAvailability(
137143
destructor->getBodySourceRange(), C.getIsolatedDeinitAvailability(),
138144
D->getDeclContext(),

test/Concurrency/deinit_isolation_availability.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
// RUN: %target-typecheck-verify-swift -swift-version 5 %s -strict-concurrency=complete -target %target-swift-6.1-abi-triple
33
// RUN: %target-typecheck-verify-swift -swift-version 5 %s -strict-concurrency=complete -target %target-swift-6.1-abi-triple -target-min-inlining-version min -verify-additional-prefix inlining-
44

5+
// Test -emit-module configurations.
6+
7+
// RUN: %target-swift-frontend -emit-module -verify -swift-version 5 %s -strict-concurrency=complete -target %target-swift-5.1-abi-triple -experimental-skip-non-inlinable-function-bodies -verify-additional-prefix inlining-
8+
// RUN: %target-swift-frontend -emit-module -verify -swift-version 5 %s -strict-concurrency=complete -target %target-swift-6.1-abi-triple -experimental-skip-non-inlinable-function-bodies -target-min-inlining-version min -verify-additional-prefix inlining-
9+
510
// REQUIRES: concurrency
611
// REQUIRES: OS=macosx
712

0 commit comments

Comments
 (0)