[Swift] Compiler crash on calling an inner function inside an extension
| Originator: | martin.kuehl | ||
| Number: | rdar://23433720 | Date Originated: | 11/06/2015 |
| Status: | Open | Resolved: | No |
| Product: | Developer Tools | Product Version: | 7.1 |
| Classification: | Crash | Reproducible: | Yes |
Summary: When defining an extension on Array, which contains a function, which contains an inner function, which provides a default value for its parameter, calls to that inner function that omit the argument lead to the Swift compiler crashing. Steps to Reproduce: See code in the attached playground. 1. Define an extension on Array 2. Define a function outer 3. Define a function inner *inside* outer 4. Declare one parameter on the function inner 5. Define a default value for the parameter of inner 6. Call inner from outer without supplying an argument Expected Results: The code compiles, the call from outer to inner invokes inner with the default value for its parameter. Actual Results: The swift compiler crashes with EXC_BAD_ACCESS. Console.app contains information about the crash and links to the crash log. Compiling equivalent code in an Xcode project indicates in the stack dump that it crashes “While emitting IR SIL function” on the line where outer calls inner. Version: Apple Swift version 2.1 (swiftlang-700.1.101.6 clang-700.1.76) Target: x86_64-apple-darwin14.5.0 Xcode 7.1 Build version 7B91b ProductName: Mac OS X ProductVersion: 10.10.5 BuildVersion: 14F1021 Notes: • Defining the extension on String prevents the crash. I have not investigated which other types lead to or work around the crash. • Supplying the default value from the caller (instead of defining it in the callee) prevents the crash. Configuration: I don’t have another machine to reproduce the crash on. Attachments: 'Extension with Inner Function with Default Argument.playground.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!