Hello All!
I’m attempting to make forward progress on this PR: https://github.com/swiftlang/swift/pull/86358. However, the changes have exposed a compiler crash. This is well outside of my comfort zone, so I’m hoping to recruit some help.
It’s kind of an annoying one to reproduce. I’ve been unable to transform this problem into an issue that is independent of those Task changes, even though it feels like it should be a more general problem.
I’ve captured the issue in a compiler branch, the details of which are in the issue I just filed. Task typed throws API change triggers crash in CapturePromotion.cpp · Issue #86391 · swiftlang/swift · GitHub
Just to save a click, here’s the reduced code:
private protocol AnyTask: Sendable {
func waitForCompletion() async
}
extension Task: AnyTask {
func waitForCompletion() async {
}
}
struct PendingTask: Sendable {
fileprivate let task: any AnyTask
}
public final class AsyncQueue: Sendable {
public init() {}
public func asyncThrowing<Success: Sendable>(
@_inheritActorContext operation: @escaping @Sendable () async throws -> Success
) -> Void {
var dependencies: [PendingTask] = []
Task {
for dependency in dependencies {
await dependency.task.waitForCompletion()
}
let result = try await operation()
return result
}
}
}
Assertion failed: (calleeConv.getSILType(cpInfo, builder.getTypeExpansionContext()) == box->getType() && "SILType of parameter info does not match type of parameter"), function processPartialApplyInst, file CapturePromotion.cpp, line 1553.
I’ve tried a number of other modifications, including removing the fileprivate there, and all make the issue go away. The Task API changes are visible in the PR, but are mostly around adopting typed throws.
Is anyone up for helping me out here?