Swift: Compiler crashes with recursive functions returning functions
| Originator: | rix.rob | ||
| Number: | rdar://18495979 | Date Originated: | 29-Sep-2014 08:58 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode-6.1 (6A1042b) |
| Classification: | Serious Bug | Reproducible: | Always |
Summary:
A recursive function returning a function crashes the compiler.
Steps to Reproduce:
1. Compile this code:
struct A {
func g<U>(recur: (A, U) -> U) -> (A, U) -> U {
return { _, x in return x }
}
func f() {
let recur: (A, A) -> A = { c, x in x }
let b = g(recur)(self, self)
}
}
Expected Results:
No crash.
Actual Results:
Crash.
Regression:
- If you don’t call g(), it doesn’t crash.
- If you use curried function syntax to define g, it doesn’t crash.
Notes:
Crash log to follow.
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!