A Swift for-in loop can terminate source kit

Originator:edward
Number:rdar://17316998 Date Originated:6/14/2014
Status:Open Resolved:
Product:Xcode Product Version:6.0 (6A215l)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
In Swift, certain for-in loops seem to crash SourceKit. In particular, this is happening while trying to enumerate with a NSAllDescendantPathsEnumerator.

Steps to Reproduce:
1. Create a new command-line tool in Xcode 6.
2. Delete all code from the main.swift file and replace it with the following:

let path = NSURL(string: NSHomeDirectory())
let fileManager = NSFileManager.defaultManager()
let enumerator = fileManager.enumeratorAtURL(path, includingPropertiesForKeys: [NSURLIsDirectoryKey], options: nil, errorHandler: nil)
for urls in enumerator {
 
}

Expected Results:
Xcode should continue to syntax highlight the code and let me run through each URL in the for-in loop.

Actual Results:
A notification appears in the middle of the screen reading:

SourceKitService Terminated
Editor Functionality Temporally Limited

Version:
Mac OS X 10.9.3
Xcode Version 6.0 (6A215l)

Notes:


Configuration:
MacBook Pro (15-ich, Early 2011)

Attachments:

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!