Xcode-7-beta (7A120f): Swift crash on dynamic var starting with "init"

Originator:segiddins
Number:rdar://21391254 Date Originated:15-Jun-2015 03:09 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-7-beta (7A120f)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
ARC requires that names starting with init and then a non-lowercase character be initializer methods. A property named initValue violates this, resulting in an extra release due to ARC expecting the method to return a +1 value when it actually returns a +0 value.

Steps to Reproduce:
Run the following Swift code:
class MyThing: NSObject {
    dynamic var initValue: Int = 0
    dynamic var finalValue: Int = 0

    func save() {
        self.valueForKey("initValue")
    }
}

let thing = MyThing()
thing.save()

Expected Results:
The compiler should error that “initValue” is a bad name for a dynamic property, or should produce the output necessary to avoid a crash

Actual Results:
Segfault

Notes:
See http://clang.llvm.org/docs/AutomaticReferenceCounting.html#method-families

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!