[Concurrency] Allow #isolation to have a more specific contextual type.

This commit is contained in:
Holly Borla
2024-02-16 14:22:53 -08:00
parent ea7d07714f
commit ddf2fc44f4
4 changed files with 43 additions and 1 deletions

View File

@@ -3923,6 +3923,13 @@ namespace {
}
Type visitCurrentContextIsolationExpr(CurrentContextIsolationExpr *E) {
// If this was expanded from the builtin `#isolation` macro, it
// already has a type.
if (auto type = E->getType())
return type;
// Otherwise, this was created for a `for await` loop, where its
// type is always `(any Actor)?`.
auto actorProto = CS.getASTContext().getProtocol(
KnownProtocolKind::Actor);
return OptionalType::get(actorProto->getDeclaredExistentialType());