Skip to content

Commit a076d54

Browse files
Merge pull request #70313 from sophiapoirier/downgrade-preconcurrency-effect-errors-revision
[Concurrency] correct AbstractFunction::isPreconcurrency logic
2 parents 406fe3e + 190f0e0 commit a076d54

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/Sema/TypeCheckEffects.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,10 @@ class ApplyClassifier {
10761076
/// global or static 'let' variables, which was previously accepted in
10771077
/// compiler versions before 5.10, or for declarations marked preconcurrency.
10781078
bool downgradeAsyncAccessToWarning(Decl *decl) {
1079+
if (decl->preconcurrency()) {
1080+
return true;
1081+
}
1082+
10791083
if (auto *var = dyn_cast<VarDecl>(decl)) {
10801084
ActorReferenceResult::Options options = llvm::None;
10811085
// The newly-diagnosed cases are invalid regardless of the module context
@@ -1086,7 +1090,7 @@ class ApplyClassifier {
10861090
}
10871091
}
10881092

1089-
return decl->preconcurrency();
1093+
return false;
10901094
}
10911095

10921096
Classification classifyLookup(LookupExpr *E) {

test/Concurrency/toplevel/async-5-top-level.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func nonIsolatedAsync() async {
2323
await print(a)
2424
a = a + 10
2525
// expected-error@-1:5 {{main actor-isolated var 'a' can not be mutated from a non-isolated context}}
26-
// expected-error@-2:9 {{expression is 'async' but is not marked with 'await'}}{{9-9=await }}
26+
// expected-warning@-2:9 {{expression is 'async' but is not marked with 'await'}}{{9-9=await }}
2727
// expected-note@-3:9 {{property access is 'async'}}
2828
}
2929

0 commit comments

Comments
 (0)