Merge pull request #70313 from sophiapoirier/downgrade-preconcurrency-effect-errors-revision

[Concurrency] correct AbstractFunction::isPreconcurrency logic
This commit is contained in:
Sophia Poirier
2023-12-08 20:59:07 -08:00
committed by GitHub
2 changed files with 6 additions and 2 deletions

View File

@@ -1076,6 +1076,10 @@ public:
/// global or static 'let' variables, which was previously accepted in
/// compiler versions before 5.10, or for declarations marked preconcurrency.
bool downgradeAsyncAccessToWarning(Decl *decl) {
if (decl->preconcurrency()) {
return true;
}
if (auto *var = dyn_cast<VarDecl>(decl)) {
ActorReferenceResult::Options options = llvm::None;
// The newly-diagnosed cases are invalid regardless of the module context
@@ -1086,7 +1090,7 @@ public:
}
}
return decl->preconcurrency();
return false;
}
Classification classifyLookup(LookupExpr *E) {

View File

@@ -23,7 +23,7 @@ func nonIsolatedAsync() async {
await print(a)
a = a + 10
// expected-error@-1:5 {{main actor-isolated var 'a' can not be mutated from a non-isolated context}}
// expected-error@-2:9 {{expression is 'async' but is not marked with 'await'}}{{9-9=await }}
// expected-warning@-2:9 {{expression is 'async' but is not marked with 'await'}}{{9-9=await }}
// expected-note@-3:9 {{property access is 'async'}}
}