Merge pull request #72324 from hborla/extract-function-isolation-expr

[Concurrency] Add a `.isolation` member on dynamically isolated function values.
This commit is contained in:
Holly Borla
2024-03-14 06:56:43 -07:00
committed by GitHub
18 changed files with 160 additions and 0 deletions

View File

@@ -2890,6 +2890,7 @@ Type ConstraintSystem::getEffectiveOverloadType(ConstraintLocator *locator,
case OverloadChoiceKind::KeyPathApplication:
case OverloadChoiceKind::TupleIndex:
case OverloadChoiceKind::MaterializePack:
case OverloadChoiceKind::ExtractFunctionIsolation:
return Type();
}
@@ -3569,6 +3570,7 @@ void ConstraintSystem::bindOverloadType(
case OverloadChoiceKind::DeclViaUnwrappedOptional:
case OverloadChoiceKind::TupleIndex:
case OverloadChoiceKind::MaterializePack:
case OverloadChoiceKind::ExtractFunctionIsolation:
case OverloadChoiceKind::KeyPathApplication:
bindTypeOrIUO(openedType);
return;
@@ -3829,6 +3831,15 @@ void ConstraintSystem::resolveOverload(ConstraintLocator *locator,
break;
}
case OverloadChoiceKind::ExtractFunctionIsolation: {
// The type of `.isolation` is `(any Actor)?`
auto actor = getASTContext().getProtocol(KnownProtocolKind::Actor);
adjustedRefType =
OptionalType::get(actor->getDeclaredExistentialType());
refType = adjustedRefType;
break;
}
case OverloadChoiceKind::KeyPathApplication: {
// Key path application looks like a subscript(keyPath: KeyPath<Base, T>).
// The element type is T or @lvalue T based on the key path subtype and
@@ -4466,6 +4477,7 @@ DeclName OverloadChoice::getName() const {
case OverloadChoiceKind::MaterializePack:
case OverloadChoiceKind::TupleIndex:
case OverloadChoiceKind::ExtractFunctionIsolation:
llvm_unreachable("no name!");
}
@@ -5830,6 +5842,7 @@ bool ConstraintSystem::diagnoseAmbiguity(ArrayRef<Solution> solutions) {
case OverloadChoiceKind::TupleIndex:
case OverloadChoiceKind::MaterializePack:
case OverloadChoiceKind::ExtractFunctionIsolation:
// FIXME: Actually diagnose something here.
break;
}