mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Replace AsyncIteratorProtocol.nextElement() with isolated next(_:)
Use an optional isolated parameter to this new `next(_:)` overload to keep it on the same actor as the caller, and pass `#isolation` when desugaring the async for..in loop. This keeps async iteration loops on the same actor, allowing non-Sendable values to be used with many async sequences.
This commit is contained in:
@@ -10705,7 +10705,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint(
|
||||
// Handle `next` reference.
|
||||
if (getContextualTypePurpose(baseExpr) == CTP_ForEachSequence &&
|
||||
(isRefTo(memberRef, ctx.Id_next, /*labels=*/{}) ||
|
||||
isRefTo(memberRef, ctx.Id_nextElement, /*labels=*/{}))) {
|
||||
isRefTo(memberRef, ctx.Id_next, /*labels=*/{StringRef()}))) {
|
||||
auto *iteratorProto = cast<ProtocolDecl>(
|
||||
getContextualType(baseExpr, /*forConstraint=*/false)
|
||||
->getAnyNominal());
|
||||
@@ -10931,8 +10931,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint(
|
||||
if (auto *base = dyn_cast<DeclRefExpr>(UDE->getBase())) {
|
||||
if (auto var = dyn_cast_or_null<VarDecl>(base->getDecl())) {
|
||||
if (var->getNameStr().contains("$generator") &&
|
||||
(UDE->getName().getBaseIdentifier() == Context.Id_next ||
|
||||
UDE->getName().getBaseIdentifier() == Context.Id_nextElement))
|
||||
(UDE->getName().getBaseIdentifier() == Context.Id_next))
|
||||
return success();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user