Swift fails to compile enum with two data cases
| Originator: | jlieske | ||
| Number: | rdar://17228613 | Date Originated: | 09-Jun-2014 00:27 AM |
| Status: | Duplicate | Resolved: | |
| Product: | OS X SDK | Product Version: | Xcode6 beta: Version 6.0 (6A215l) |
| Classification: | Crash | Reproducible: | Always |
The Swift language supports enums with type parameters for associated values. Such enum types should support recursive relationships, such as the classic linked list.
For example, this seems to be a reasonable enum declaration:
enum Result<SuccessType, ErrorType> {
case Success(SuccessType)
case Error(ErrorType)
}
However, it fails to compile in Swift source code files. The compiler reports the error:
/Users/jay/Coding/Swift/TrySwift/TryEither/main.swift:11:6: error: unimplemented IR generation feature non-fixed multi-payload enum layout
enum Result<SuccessType, ErrorType> {
^
LLVM ERROR: unimplemented IRGen feature! non-fixed multi-payload enum layout
Command /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift failed with exit code 1
Furthermore, pasting that class definition in a Playground file causes Xcode to crash. When Xcode tries to re-launch with the Playground file with the definition, it crashes repeatedly.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Apple closed as duplicate of rdar://16020432