SourceKit Service crashes in generic Swift function

Originator:bmvdweerd
Number:rdar://25306327 Date Originated:20160322
Status:Closed Resolved:20160505 (Xcode 7.3.1)
Product:Xcode Product Version:7.3
Classification:Developer Tools Reproducible:Always
 
Summary:
When editing a Swift source file in Xcode, option- or command-clicking on certain variables inside generic functions causes the SourceKit Service to crash, which results in a loss of semantic source highlighting in Xcode.

Steps to Reproduce:
1. Install and launch Xcode
2. Start a new project, e.g. an iOS framework, fill in details, etc.
3. Add a new Swift file to the project and paste the following snippet in to it: func foo<T>() -> T? { let bar: T? = nil; return bar }
4. Option- or command-click on the last occurrence of the word ‘bar’ in the snippet.

Expected Results:
A tooltip should pop up displaying the variable’s declaration signature (let bar: T?), and the location of its declaration (the name of the Swift source file).

Actual Results:
SourceKit Service crashes (can be seen in Console.app), which in Xcode tends to result in a loss of semantic source highlighting (i.e. all source code turns black). When after a while highlighting recovers, and step 4. is repeated, SourceKit Service crashes again, and Xcode shows the yellow-font “An internal error occurred…” bar along the top of the editor.

Version:
OS X 10.11.4 (15E65), Xcode 7.3 (7D175).

Notes:
The crash log backtrace points to a EXC_BAD_ACCESS in “com.apple.SourceKitService.703.0.18.1 0x0000000108a45311 (anonymous namespace)::PrintAST::printGenericParams(swift::GenericParamList*) + 209”.

Configuration:
Retina MacBook Pro (MacBookPro11,2), no external hardware attached.

Comments

Resolved as of Xcode 7.3.1, released on May 5, 2016.

By bmvdweerd at May 7, 2016, 6:49 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!