Swift: a class defined inside a function crash the compiler if it uses a local variable of that function

Originator:gwendal.roue
Number:rdar://18850296 Date Originated:3/11/2014
Status:Open Resolved:
Product:Developper Tools Product Version:Xcode 6.1 (6A1052d)
Classification:Crash Reproducible:Always
 
Summary:
A class defined inside a function crash the compiler if it uses a local variable of that function

Steps to Reproduce:
Run the following code:

func f() {
    let x = 0
    class C {
        func f() {
            x
        }
    }
}


Expected Results:
No compiler crash. And even better, a compiler success without any error. It would be nice to let inner private classes access local variables.

Actual Results:
Compiler crash

Version:
Xcode 6.1 (6A1052d)

Notes:


Configuration:
OSX 10.10 (14A389)

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!