Swift: reduced test case of runtime crash involving nil
| Originator: | kenferry | ||
| Number: | rdar://17670029 | Date Originated: | 7/14/2014 |
| Status: | Open | Resolved: | |
| Product: | Product Version: | ||
| Classification: | Reproducible: |
Summary:
This code compiles but crashes at runtime
let nilList : LinkedListTest<Int>? = nil
if nilList {
println("bug still present (or crash on previous line)")
} else {
println("looks ok now")
}
where LinkedListTest is defined like so:
struct LinkedListTest<T> {
let val:T
let next:OnHeap<()->Optional<LinkedListTest<T>>>
init(val:T, next:()->Optional<LinkedListTest<T>>) {
self.val = val
self.next = OnHeap(next)
}
}
Steps to Reproduce:
Run attached project
Expected Results:
prints "looks ok now"
Actual Results:
Crashes.
Version:
Xcode 6.0 Seed 3, 6A254o
OS X 10.10 Seed 3, (14A283o)
Notes:
Configuration:
Mid 2012 Retina MBP
Attachments:
'Isolate.zip' was 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!