didSet on property of protocol type infinite recursive loop

Originator:sebastian
Number:rdar://22574299 Date Originated:04-Sep-2015 10:43 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7 beta 6
Classification:High Reproducible:Always
 
Summary:
This is a regression bug introduced in Swift 2. If you have a property "x" of a protocol type and you provide a property observer for "didSet" in which you call a function that in turn access (doesn't set) a property of property "x" it will cause "didSet" to be called recursively infinitely until the program crashes. This worked in Swift 1.x and since the property is not set but only read it should not trigger "didSet".

Steps to Reproduce:
See attacked playground to reproduce.

Expected Results:
"didSet" should not be called recursively since the property is never re-set.

Actual Results:
The program hangs with infinite recursive calls to “didSet”.

Version:
Xcode 7 beta 6

Notes:
This is a regression in Swift 2%2C as this worked fine on Swift 1.x.

Configuration:
Happens always on Xcode 7 beta 6

Attachments:
'didSetProtocolTypeProperty.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!