Swift Nested Functions don't compile
| Originator: | tomburns | ||
| Number: | rdar://17221632 | Date Originated: | 6/8/14 |
| Status: | Open | Resolved: | |
| Product: | Swift | Product Version: | |
| Classification: | Reproducible: |
Summary:
func fibonacci(n: Int) -> Int {
func fibonacciStep(a: Int, b: Int, count: Int) -> Int {
if (count > 0) {
return fibonacciStep(b, a+b, count-1)
} else {
return a
}
}
return fibonacciStep(0, 1, n)
}
results in
Playground execution failed: error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x1).
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
* thread #1: tid = 0x4b7f8b, 0x0000000000000001, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x1)
* frame #0: 0x0000000000000001
Steps to Reproduce:
1. nest two functions in swift, either in playground or normal IDE environments
Expected Results:
Code should compile and run normally
Actual Results:
Either a crash or a caught error as above
Version:
Xcode 6 beta 1, 10.9.3
Notes:
Configuration:
Swift
Attachments:
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!