swiftc segfault: defining a computed var closure to call itself

Originator:nathaniel.chandler
Number:rdar://19729224 Date Originated:02/05/2015
Status:Closed Resolved:Duplicate of 11266246 (Open)
Product:swiftc/Xcode Product Version:Xcode versions 6A2008a, 6C86e
Classification:Serious Bug Reproducible:Always
 
Summary:
It is fine to reference a computed var in global scope that defined in terms of itself, though a compiler warning is (appropriately generated).  For example, when compiling this code 

var closure:()->() {
    return {
        closure()
    }
}

swiftc gives the warning 

"Attempting to access 'closure' within its own getter".

Unfortunately, the situation is not so good when the computed var is within a function.  When compiling this code

func function() {
    var local:()->() {
        return { local() }
    }
}

swiftc segfaults.

Steps to Reproduce:
1.  Feed swiftc the following text:

func function() {
    var local:()->() {
        return { local() }
    }
}

2.  Witness the compiler segfault.

Expected Results:
The behavior should be the same as if the computed var were global.

Actual Results:
Swift Compiler Error
Command failed due to signal:
Segmentation fault: 11

Version:
6.1.1 (6A2008a)
6.2 Beta (6C86e)

Notes:


Configuration:


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!