mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -205,6 +205,7 @@ static bool areConservativelyCompatibleArgumentLabels(
|
||||
case OverloadChoiceKind::KeyPathDynamicMemberLookup:
|
||||
case OverloadChoiceKind::TupleIndex:
|
||||
case OverloadChoiceKind::MaterializePack:
|
||||
case OverloadChoiceKind::ExtractFunctionIsolation:
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -9763,6 +9764,16 @@ performMemberLookup(ConstraintKind constraintKind, DeclNameRef memberName,
|
||||
if (auto *selfTy = instanceTy->getAs<DynamicSelfType>())
|
||||
instanceTy = selfTy->getSelfType();
|
||||
|
||||
// Dynamically isolated function types have a magic '.isolation'
|
||||
// member that extracts the isolation value.
|
||||
if (auto *fn = dyn_cast<FunctionType>(instanceTy)) {
|
||||
if (fn->getIsolation().isErased() &&
|
||||
memberName.getBaseIdentifier().str() == "isolation") {
|
||||
result.ViableCandidates.push_back(
|
||||
OverloadChoice(baseTy, OverloadChoiceKind::ExtractFunctionIsolation));
|
||||
}
|
||||
}
|
||||
|
||||
if (!instanceTy->mayHaveMembers())
|
||||
return result;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user