mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Concurrency] Allow #isolation to have a more specific contextual type.
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user