Swift compiler crashes when static computed properties in protocol extensions are declared public

Originator:nrith99
Number:rdar://28011726 Date Originated:08/25/2016
Status:Open Resolved:
Product:Xcode Product Version:7.3.1
Classification: Reproducible:Always
 
Area:
Xcode

Summary:
A Swift protocol extension's implementation of a static property that was declared in a public protocol causes the compiler to crash when the protocol extension's implementation is also declared public. A sample playground and crash log are attached.

Steps to Reproduce:
1. In a playground or other Swift file, declare a *public* protocol with a static property.
2. Create a protocol extension for it.
3. Implement the static property in the protocol extension by having it get and set some computed value (e.g. setting/getting a property in NSUserDefaults.standardUserDefaults()). Do NOT declare it public.
4. Create a *public* struct or class that implements the protocol.
5. The compiler will flag the static property in the protocol extension, saying that it needs to be public.
6. Add a public modifier to the property's implementation in the protocol extension, and watch the compiler crash with a segmentation fault.

Expected Results:
I expected the static property in the protocol extension to compile properly when being declared public.

Actual Results:
When the static property in the protocol extension is made public, then the Swift compiler crashes.

Version:
Xcode 7.3.1 (7D1014) with the iPhone 5 simulator running iOS 9.3, all on OS X El Capitan 10.11.6

Notes:


Configuration:
MacBook Pro (Retina, 15-inch, Late 2013), 2.3 GHz Intel Core i7, 16 GB memory

Attachments:
'PublicStaticProtocolExtensions.playground.zip' and 'com.apple.dt.Xcode.Playground_2016-08-25-125719_Developer-Jasons-laptop.crash' were 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!