Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

BSON.Value rawValue initializer does not recognize arrays #20

Open
svanimpe opened this issue Mar 5, 2016 · 2 comments
Open

BSON.Value rawValue initializer does not recognize arrays #20

svanimpe opened this issue Mar 5, 2016 · 2 comments

Comments

@svanimpe
Copy link

svanimpe commented Mar 5, 2016

The following test does not succeed with a rawValue of [-73, 40]:

if let rawArray = rawValue as? [Any]

This is using the March 1 build of Swift on Ubuntu 15.10

@svanimpe
Copy link
Author

svanimpe commented Mar 5, 2016

Looks like Any can't be cast to [Any] for some reason. A more specific cast to [Int] does work.

@Danappelxx
Copy link
Owner

Yeah - all of this is an issue in a pure-swift environment because it doesn't have objective-c to do some higher-level type casting. I'm not sure what the Swift team is going to do about this but for now I think it's safest to remove the rawValue initializer so that people don't get surprised by this sort of behavior.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants