Collection casting to protocol types

Originator:an00na
Number:rdar://22720445 Date Originated:16-Sep-2015 11:06 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Swift 2.0
Classification:Enhancement Reproducible:Not Applicable
 
Currently, the casting in last line fails:
["a": "a"] as? [String: Any]
let a: AnyObject = ["a": "a"]
a as? [String: String]
a as? [String: AnyObject]
a as? [String: Any]

Sometimes we need this kind of casting for collections of mixed types.

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!