Can't add class objects to Swift collections in Swift

Originator:exsephiroth87
Number:rdar://17240749 Date Originated:09/06/2014
Status:Closed Resolved:Xcode 6.2
Product:Developer Tools Product Version:Xcode Version 6.0 (6A215l)
Classification: Reproducible:Always
 
Summary:
Trying to add a class object to a collection gives a runtime exception

Steps to Reproduce:
Sample code

var objClass = NSObject.self
var array = [objClass]

Expected Results:
The class object is added to the collection

Actual Results:
Playground execution failed: error: Execution was interrupted, reason: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0).
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
* thread #1: tid = 0x0e52, 0x0000000100139bf1 libswift_stdlib_core.dylib`protocol witness for Swift._Collection.endIndex.getter : Swift._Collection.Self.IndexType in conformance Swift.UnsafeArray : Swift._Collection + 65, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
  * frame #0: 0x0000000100139bf1 libswift_stdlib_core.dylib`protocol witness for Swift._Collection.endIndex.getter : Swift._Collection.Self.IndexType in conformance Swift.UnsafeArray : Swift._Collection + 65
    frame #1: 0x0000000100090880 libswift_stdlib_core.dylib`Swift.countElements <A : Swift._Collection>(A) -> A.IndexType.DistanceType + 160
    frame #2: 0x0000000100091532 libswift_stdlib_core.dylib`Swift._copyCollectionToNativeArrayBuffer <A : protocol<Swift._Collection, Swift._Sequence_>>(A) -> Swift.ContiguousArrayBuffer<A.GeneratorType.Element> + 242
    frame #3: 0x0000000100139ebc libswift_stdlib_core.dylib`protocol witness for Swift.Sequence.~> @infix <A : Swift.Sequence>(Swift.Sequence.Self.Type)(Swift.Sequence.Self, (Swift._CopyToNativeArrayBuffer, ())) -> Swift.ContiguousArrayBuffer<Swift.Sequence.Self.GeneratorType.Element> in conformance Swift.UnsafeArray : Swift.Sequence + 188
    frame #4: 0x000000010bfefbea

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!