Skip to content

Commit d36f815

Browse files
committed
[Concurrency] unguard nonisolated(unsafe) attribute from GlobalConcurrency experimental feature
1 parent bf102d2 commit d36f815

File tree

4 files changed

+5
-14
lines changed

4 files changed

+5
-14
lines changed

lib/ASTGen/Sources/ASTGen/SourceFile.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ extension Parser.ExperimentalFeatures {
5555
mapFeature(.TypedThrows, to: .typedThrows)
5656
mapFeature(.DoExpressions, to: .doExpressions)
5757
mapFeature(.NonEscapableTypes, to: .nonEscapableTypes)
58-
mapFeature(.GlobalConcurrency, to: .globalConcurrency)
5958
}
6059
}
6160

lib/Parse/ParseDecl.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5579,8 +5579,7 @@ bool Parser::isStartOfSwiftDecl(bool allowPoundIfAttributes,
55795579
}
55805580

55815581
// If this is 'nonisolated', check to see if it is valid.
5582-
if (Context.LangOpts.hasFeature(Feature::GlobalConcurrency) &&
5583-
Tok.isContextualKeyword("nonisolated") && Tok2.is(tok::l_paren) &&
5582+
if (Tok.isContextualKeyword("nonisolated") && Tok2.is(tok::l_paren) &&
55845583
isParenthesizedNonisolated(*this)) {
55855584
BacktrackingScope backtrack(*this);
55865585
consumeToken(tok::identifier);

lib/Sema/TypeCheckAttr.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6831,14 +6831,11 @@ void AttributeChecker::visitNonisolatedAttr(NonisolatedAttr *attr) {
68316831
auto dc = D->getDeclContext();
68326832

68336833
if (auto var = dyn_cast<VarDecl>(D)) {
6834-
const bool isUnsafe =
6835-
attr->isUnsafe() && Ctx.LangOpts.hasFeature(Feature::GlobalConcurrency);
6836-
68376834
// stored properties have limitations as to when they can be nonisolated.
68386835
if (var->hasStorage()) {
68396836
// 'nonisolated' can not be applied to mutable stored properties unless
68406837
// qualified as 'unsafe'.
6841-
if (var->supportsMutation() && !isUnsafe) {
6838+
if (var->supportsMutation() && !attr->isUnsafe()) {
68426839
diagnoseAndRemoveAttr(attr, diag::nonisolated_mutable_storage);
68436840
return;
68446841
}
@@ -6883,7 +6880,7 @@ void AttributeChecker::visitNonisolatedAttr(NonisolatedAttr *attr) {
68836880

68846881
// nonisolated can not be applied to local properties unless qualified as
68856882
// 'unsafe'.
6886-
if (dc->isLocalContext() && !isUnsafe) {
6883+
if (dc->isLocalContext() && !attr->isUnsafe()) {
68876884
diagnoseAndRemoveAttr(attr, diag::nonisolated_local_var);
68886885
return;
68896886
}

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2833,9 +2833,7 @@ namespace {
28332833
if (getActorIsolation(value).isActorIsolated())
28342834
return false;
28352835

2836-
if (auto attr = value->getAttrs().getAttribute<NonisolatedAttr>();
2837-
ctx.LangOpts.hasFeature(Feature::GlobalConcurrency) && attr &&
2838-
attr->isUnsafe()) {
2836+
if (auto attr = value->getAttrs().getAttribute<NonisolatedAttr>(); attr && attr->isUnsafe()) {
28392837
return false;
28402838
}
28412839

@@ -3305,9 +3303,7 @@ namespace {
33053303
}
33063304
}
33073305

3308-
if (auto attr = var->getAttrs().getAttribute<NonisolatedAttr>();
3309-
ctx.LangOpts.hasFeature(Feature::GlobalConcurrency) && attr &&
3310-
attr->isUnsafe()) {
3306+
if (auto attr = var->getAttrs().getAttribute<NonisolatedAttr>(); attr && attr->isUnsafe()) {
33113307
return false;
33123308
}
33133309

0 commit comments

Comments
 (0)