Skip to content

Allow SingleValueContainers to decode collections #10249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2017

Conversation

itaiferber
Copy link
Contributor

What's in this pull request?
Addresses SR-5089.

SingleValueDecondingContainers in JSON and Plist previously held the assertion that attempting to decode an array or dictionary from them was a type mismatch (since those represented unkeyed and keyed containers, respectively). This assertion is no longer true, though, since encode<T : Encodable>(_:) and decode<T : Decodable>(_:) allow you to do just that.

This lifts the assertion and adds unit tests to both implementations to ensure this works.

SingleValueDecondingContainers in JSON and Plist previously held the
assertion that attempting to decode an array or dictionary from them
was a type mismatch (since those represented unkeyed and keyed
containers, respectively). This assertion is no longer true, though,
since encode<T : Encodable>(_:) and decode<T : Decodable>(_:) allow
you to do just that.

This lifts the assertion and adds unit tests to both implementations to
ensure this works. (Addresses https://bugs.swift.org/browse/SR-5089)
@itaiferber
Copy link
Contributor Author

@swift-ci Please test

@itaiferber itaiferber requested a review from phausler June 14, 2017 21:18
Copy link
Contributor

@phausler phausler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@itaiferber itaiferber merged commit 5daa71c into swiftlang:master Jun 14, 2017
@itaiferber
Copy link
Contributor Author

@phausler Thanks, Philippe!

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

Successfully merging this pull request may close these issues.

2 participants