Open
Description
Description
The compiler crashes when combining the use of variadic generics with opaque types.
Compiler crash message in Xcode:
Command SwiftEmitModule failed with a nonzero exit code
Steps to reproduce
Minimal reproducible example code:
protocol P {
associatedtype New: P
func new() -> New
}
struct A: P {
func new() -> some P {
A()
}
}
struct B<each T: P>: P {
func new() -> some P { // <- CHANGE ME
B<A>()
}
}
The above code fails to compile. Changing the second some P
to the more explicit B<A>
in this example fixes the issue.
Expected behavior
Successful compilation by having the return type be inferred with the opaque type rather than having to manually specify it.
Environment
- Swift compiler version info
swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.106 clang-1500.0.40.1)
Target: arm64-apple-macosx13.0 - Xcode version info
Xcode 15.0
Build version 15A5229m - Deployment target
iOS 17