Swift protocol subscript signature mismatch compiler crash

Originator:keithbsmiley
Number:rdar://22981205 Date Originated:05-Oct-2015 03:45 PM
Status:Resolved Resolved:
Product:iOS SDK Product Version:Swift 2.0
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:

swiftc crashes when there is a function signature mismatch between a
subscript defined in a protocol and the implmentation of that subscript
function in a class inheriting from the protocol.

Steps to reproduce:

1. Run `swiftc subscriptCrash.swift`

OR:

1. Create a protocol which specifies a subscript function with 2
   arguments. Make sure the second argument has a label
2. Conform to this protocol from a class, by remove the argument or
   label from the definition in the class
3. Attempt to run `swiftc` on your file

Expected results:

A compiler error that the subscript signature in the implementation does
not match that expected from the protocol is produced.

Actual results:

The compiler crashes, giving no obvious sign that there is a signature
mismatch.

Notes:

- This is fixed immediately by fixing the implementation's signature

Comments

This is fixed in Swift 3.0 bundled with Xcode 8 beta 1

By keithbsmiley at June 20, 2016, 7:04 a.m. (reply...)

See example here: https://github.com/keith/radars/tree/master/SwiftProtocolSubscriptCrash

By keithbsmiley at Oct. 5, 2015, 10:47 p.m. (reply...)

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!