Skip to content
9 changes: 9 additions & 0 deletions lib/SILGen/SILGenProlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,15 @@ SILValue SILGenFunction::emitLoadActorExecutor(SILLocation loc,
else
actorV = actor.borrow(*this, loc).getValue();

// Open an existential actor type.
CanType actorType = actor.getType().getASTType();
if (actorType->isExistentialType()) {
actorType = OpenedArchetypeType::get(
actorType, F.getGenericSignature())->getCanonicalType();
SILType loweredActorType = getLoweredType(actorType);
actorV = B.createOpenExistentialRef(loc, actorV, loweredActorType);
}

// For now, we just want to emit a hop_to_executor directly to the
// actor; LowerHopToActor will add the emission logic necessary later.
return actorV;
Expand Down
5 changes: 5 additions & 0 deletions lib/Sema/TypeCheckProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3060,6 +3060,11 @@ Optional<ActorIsolation> ConformanceChecker::checkActorIsolation(
diagnoseNonSendableTypesInReference(
getConcreteWitness(), DC, loc, SendableCheckReason::Conformance);

// If the witness is accessible across actors, we don't need to consider it
// isolated.
if (isAccessibleAcrossActors(witness, refResult.isolation, DC))
return None;

if (refResult.isolation.isActorIsolated() && isAsyncDecl(requirement) &&
!isAsyncDecl(witness))
return refResult.isolation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ internal final class CheckedContinuationCanary: @unchecked Sendable {
/// you can replace one with the other in most circumstances,
/// without making other changes.
@available(SwiftStdlib 5.1, *)
public struct CheckedContinuation<T, E: Error> {
public struct CheckedContinuation<T, E: Error>: Sendable {
private let canary: CheckedContinuationCanary

/// Creates a checked continuation from an unsafe continuation.
Expand Down Expand Up @@ -186,9 +186,6 @@ public struct CheckedContinuation<T, E: Error> {
}
}

@available(SwiftStdlib 5.1, *)
extension CheckedContinuation: Sendable where T: Sendable { }

@available(SwiftStdlib 5.1, *)
extension CheckedContinuation {
/// Resume the task awaiting the continuation by having it either
Expand Down
5 changes: 1 addition & 4 deletions stdlib/public/BackDeployConcurrency/PartialAsyncTask.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public struct UnownedJob: Sendable {
/// without making other changes.
@available(SwiftStdlib 5.1, *)
@frozen
public struct UnsafeContinuation<T, E: Error> {
public struct UnsafeContinuation<T, E: Error>: Sendable {
@usableFromInline internal var context: Builtin.RawUnsafeContinuation

@_alwaysEmitIntoClient
Expand Down Expand Up @@ -144,9 +144,6 @@ public struct UnsafeContinuation<T, E: Error> {
}
}

@available(SwiftStdlib 5.1, *)
extension UnsafeContinuation: Sendable where T: Sendable { }

@available(SwiftStdlib 5.1, *)
extension UnsafeContinuation {
/// Resume the task that's awaiting the continuation
Expand Down
5 changes: 1 addition & 4 deletions stdlib/public/Concurrency/CheckedContinuation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ internal final class CheckedContinuationCanary: @unchecked Sendable {
/// you can replace one with the other in most circumstances,
/// without making other changes.
@available(SwiftStdlib 5.1, *)
public struct CheckedContinuation<T, E: Error> {
public struct CheckedContinuation<T, E: Error>: Sendable {
private let canary: CheckedContinuationCanary

/// Creates a checked continuation from an unsafe continuation.
Expand Down Expand Up @@ -186,9 +186,6 @@ public struct CheckedContinuation<T, E: Error> {
}
}

@available(SwiftStdlib 5.1, *)
extension CheckedContinuation: Sendable where T: Sendable { }

@available(SwiftStdlib 5.1, *)
extension CheckedContinuation {
/// Resume the task awaiting the continuation by having it either
Expand Down
5 changes: 1 addition & 4 deletions stdlib/public/Concurrency/PartialAsyncTask.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public struct UnownedJob: Sendable {
/// without making other changes.
@available(SwiftStdlib 5.1, *)
@frozen
public struct UnsafeContinuation<T, E: Error> {
public struct UnsafeContinuation<T, E: Error>: Sendable {
@usableFromInline internal var context: Builtin.RawUnsafeContinuation

@_alwaysEmitIntoClient
Expand Down Expand Up @@ -144,9 +144,6 @@ public struct UnsafeContinuation<T, E: Error> {
}
}

@available(SwiftStdlib 5.1, *)
extension UnsafeContinuation: Sendable where T: Sendable { }

@available(SwiftStdlib 5.1, *)
extension UnsafeContinuation {
/// Resume the task that's awaiting the continuation
Expand Down
2 changes: 2 additions & 0 deletions stdlib/public/Concurrency/TaskGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import Swift
/// use the `withThrowingTaskGroup(of:returning:body:)` method instead.
@available(SwiftStdlib 5.1, *)
@_silgen_name("$ss13withTaskGroup2of9returning4bodyq_xm_q_mq_ScGyxGzYaXEtYar0_lF")
@_unsafeInheritExecutor
@inlinable
public func withTaskGroup<ChildTaskResult, GroupResult>(
of childTaskResultType: ChildTaskResult.Type,
Expand Down Expand Up @@ -157,6 +158,7 @@ public func withTaskGroup<ChildTaskResult, GroupResult>(
/// or to let the group rethrow the error.
@available(SwiftStdlib 5.1, *)
@_silgen_name("$ss21withThrowingTaskGroup2of9returning4bodyq_xm_q_mq_Scgyxs5Error_pGzYaKXEtYaKr0_lF")
@_unsafeInheritExecutor
@inlinable
public func withThrowingTaskGroup<ChildTaskResult, GroupResult>(
of childTaskResultType: ChildTaskResult.Type,
Expand Down
Loading