Skip to content

Commit d5b6caf

Browse files
authored
Merge pull request #59824 from jckarter/missing-sendable-conformance-in-subst-function-type-5.7
[5.7] SIL: Allow missing Sendable conformances when building abstraction pattern for function type lowering.
2 parents bbf7650 + cda0e23 commit d5b6caf

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

lib/SIL/IR/AbstractionPattern.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1903,7 +1903,8 @@ const {
19031903
if (conformingReplacementType->isTypeParameter())
19041904
return ProtocolConformanceRef(conformedProtocol);
19051905

1906-
return TC.M.lookupConformance(conformingReplacementType, conformedProtocol);
1906+
return TC.M.lookupConformance(conformingReplacementType, conformedProtocol,
1907+
/*allowMissing*/ true);
19071908
});
19081909

19091910
auto yieldType = visitor.substYieldType;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// RUN: %target-swift-emit-silgen -warn-concurrency %s
2+
3+
protocol ServerStream {}
4+
protocol Message {}
5+
6+
struct RPCServerHandlerContext {}
7+
struct RPCRequestStream<Request: Sendable> {}
8+
struct RPCResponseStream<Response: Sendable> {}
9+
10+
final class RPCServerHandler<Stream: ServerStream, Request: Message, Response: Message> {
11+
/// The actual user function. We are using a bi-directional function shape here and will map the other shapes into this one.
12+
private let userFunction: (
13+
RPCServerHandlerContext,
14+
RPCRequestStream<Request>,
15+
RPCResponseStream<Response>
16+
) async throws -> Void
17+
18+
init(
19+
userFunction: @escaping @Sendable (
20+
RPCServerHandlerContext,
21+
RPCRequestStream<Request>,
22+
RPCResponseStream<Response>
23+
) async throws -> Void
24+
) {
25+
self.userFunction = userFunction
26+
}
27+
}

0 commit comments

Comments
 (0)