-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Coding] Make Codable conformances for Optional and collections conditional. #13178
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
[Coding] Make Codable conformances for Optional and collections conditional. #13178
Conversation
…tional. Array, Set, Dictionary, and Optional all provide unconditional conformances to Encodable & Decodable that dynamically check whether their type arguments are Encodable/Decodable. Now that we have conditional conformances, make these unconditional conformances properly conditional, removing all of the Swift 4-era type-erasure hacks. Fixes rdar://problem/34989162.
@swift-ci please test |
Build failed |
@swift-ci please smoke test Linux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These look good! (I have pretty much line for line the same diff on a local branch here.) We can further simplify DerivedConformanceCodable.cpp
by removing the explicit checks for Array
, Dictionary
, Set
, and Optional
as well — mentioned this via email but wanted to make sure the commend didn't get lost.
The Codable synthesis code was checking the conditional requirements of Optional/Array/Set/Dictionary's Codable conformances, which had to be unconditional. Now that they are properly conditional conformances, we no longer need the hack. Thanks to @itaiferber for pointing this out!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, thank you, Doug! 😄
@swift-ci please test and merge |
@swift-ci please test |
@swift-ci please test source compatibility |
Build failed |
@swift-ci please test source compatibility |
@swift-ci please smoke test Linux |
1 similar comment
@swift-ci please smoke test Linux |
Build failed |
🎉🙌 |
Are |
@norio-nomura |
@itaiferber Oh, yes. I was a bit confused. Thank you very much. |
Array, Set, Dictionary, and Optional all provide unconditional conformances
to Encodable & Decodable that dynamically check whether their type arguments
are Encodable/Decodable. Now that we have conditional conformances, make
these unconditional conformances properly conditional, removing all of
the Swift 4-era type-erasure hacks.
Fixes rdar://problem/34989162.