Swift compiler hang: nested pattern match with type-cast
| Originator: | klazuka | ||
| Number: | rdar://17970286 | Date Originated: | 8/9/2014 |
| Status: | Open | Resolved: | |
| Product: | Xcode | Product Version: | Xcode6-beta5 (6A279r) |
| Classification: | Serious | Reproducible: | Always |
Summary: The Swift compiler will hang when trying to compile a switch statement that does a nested pattern match with a type-cast. I have attached a playground file which demonstrates the problem, as well as callstack samples from Activity Monitor. Steps to Reproduce: See attached playground file. Specifically, write a switch statement that includes at least 2 cases that look like the following: case .C(.A, let foo as String): Expected Results: The compiler should never hang Actual Results: The compiler hangs forever Version: Xcode6-beta5 (6A279r) OSX 10.9.4 (13E28) Notes: Configuration: Macbook pro running mavericks Attachments: 'SwitchTypeCastBug.playground.zip', 'Sample of SourceKitService.txt' and 'Sample of com.apple.dt.Xcode.Playground.txt' were successfully uploaded.
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!
The offending Swift code / playground
// Playground - noun: a place where people can play
import Foundation
enum Inner { case A case B }
enum Outer { case C(Inner, Any) }
let x = Outer.C(Inner.A, "hello")
switch x { case .C(.A, let foo as String): println("C/A string '(foo)'") case .C(.B, let foo as String): println("C/B string '(foo)'") default: println("default") }