Skip to content

Commit aea1084

Browse files
committed
"nonisolated deinit" does not have back-deployment constraints
Fixes rdar://150484159
1 parent d6c8812 commit aea1084

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7771,8 +7771,6 @@ void AttributeChecker::visitNonisolatedAttr(NonisolatedAttr *attr) {
77717771
}
77727772
}
77737773

7774-
diagnoseIsolatedDeinitInValueTypes(attr);
7775-
77767774
if (auto VD = dyn_cast<ValueDecl>(D)) {
77777775
//'nonisolated(unsafe)' is meaningless for computed properties, functions etc.
77787776
auto var = dyn_cast<VarDecl>(VD);
@@ -7807,8 +7805,6 @@ void AttributeChecker::visitGlobalActorAttr(GlobalActorAttr *attr) {
78077805
return;
78087806
}
78097807

7810-
diagnoseIsolatedDeinitInValueTypes(attr);
7811-
78127808
(void)nominal->isGlobalActor();
78137809
}
78147810

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %target-typecheck-verify-swift -swift-version 5 %s -strict-concurrency=complete -target %target-swift-5.1-abi-triple
2+
3+
// REQUIRES: concurrency
4+
// REQUIRES: OS=macosx
5+
6+
class NotSendable {}
7+
8+
@MainActor class C {
9+
var x: Int = 0
10+
11+
nonisolated deinit {
12+
print(x)
13+
}
14+
}
15+
16+
// expected-note@+1{{add '@available' attribute to enclosing class}}
17+
@MainActor class C2 {
18+
var x: Int = 0
19+
20+
isolated deinit { // expected-error{{isolated deinit is only available in macOS 15.4.0 or newer}}
21+
print(x)
22+
}
23+
}

0 commit comments

Comments
 (0)