The compiler error when creating an NSArray from a Swift array of structs in unclear

Originator:krazyyak
Number:rdar://18638765 Date Originated:10/13/2014
Status:Open Resolved:
Product:Xcode Product Version:6.0.1 (6A317)
Classification: Reproducible:Always
 
Summary:
Using `var foo = NSArray(array: myArray)` will raise a compiler error if `myArray` is composed of Structs. The error message is misleading: "Extra argument 'array' in call".

Steps to Reproduce:
Sample code:

struct Derp {
}

var arrayOfDerps = [Derp]()
var nsarrayOfDerps = NSArray(array: arrayOfDerps)

Last line will raise the error.

Expected Results:
A better error message: "Cannot create an NSArray out of Structs"

Actual Results:
Misleading error message: "Extra argument 'array' in call"

Version:
Xcode 6.0.1 (6A317)

Notes:


Configuration:


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!