Stack implemented with enum causes Abort trap: 6
Originator: | GriotSpeak | ||
Number: | rdar://22103992 | Date Originated: | 01-Aug-2015 04:22 PM |
Status: | Open | Resolved: | |
Product: | Developer Tools | Product Version: | Xcode-beta (7A165t) |
Classification: | Enhancement | Reproducible: | Always |
Summary: The source included below causes the swift compiler to trap. Steps to Reproduce: enum Stack<T> { typealias Element = T case Empty indirect case Cons(Element, Stack) } extension Stack { var isEmpty: Bool { switch self { case .Empty: return true case .Cons: return false } } var head:Element? { if case let .Cons(theHead, _) = self { return theHead } else { return nil } } var tail:Stack? { if case let .Cons(_, theTail) = self { return theTail } else { return nil } } } Expected Results: Either successful compilation or errors indicating the problem Actual Results: Command failed due to signal: Abort trap: 6
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!