Skip to content
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

Fix decoding of enum with associated values when enum case does not contain value #265

Merged

Conversation

Alkenso
Copy link
Contributor

@Alkenso Alkenso commented Apr 26, 2023

Consider enum with associated values, where some value is empty

enum Choice: Equatable, Codable {
      case one
      case two(Int)
      case three(String, value: Int)
}

This PR fix decoding of such enum (while encoding is already worked as expected)
See new test in commit for details

Seems it also fixes #202

@Alkenso
Copy link
Contributor Author

Alkenso commented May 1, 2023

@MaxDesiatov , please comment or approve the PR

@MaxDesiatov
Copy link
Collaborator

MaxDesiatov commented May 1, 2023

I no longer maintain this library, please avoid pinging me in PRs or issues I don't work on. Thanks!

@Alkenso
Copy link
Contributor Author

Alkenso commented May 1, 2023

@Joannis , maybe you could take a look?

FYI: some tests are broken because of lack Swift support for codable enums with associated values in old versions of Xcode

@Joannis
Copy link
Member

Joannis commented May 2, 2023

Thanks for pinging me @Alkenso , feel free to ping me anytime I overlook a PR or issue.
It's impossible to support a Swift feature that that compiler version itself does not yet support, so you get a free pass there with a compiler directive to let the tests go on.

@Alkenso Alkenso force-pushed the fix_decode_enum_associated_enumpty_value branch from 2cba711 to 6661d69 Compare May 2, 2023 17:07
@Alkenso Alkenso requested a review from Joannis May 2, 2023 17:08
@Alkenso
Copy link
Contributor Author

Alkenso commented May 3, 2023

@Joannis Please re-run failed job

@Alkenso
Copy link
Contributor Author

Alkenso commented May 3, 2023

Looks very strange. Especially that all works fine on newer and older versions.
Maybe something broken on CI? How can I check it?

@Joannis
Copy link
Member

Joannis commented May 4, 2023

@Alkenso a previous PR also failed on the same runner, I think this is a CI failure on Xcode 13.1/macOS 11.

Copy link
Member

@Joannis Joannis 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!

@Joannis Joannis merged commit b15a479 into CoreOffice:main May 4, 2023
@Alkenso Alkenso deleted the fix_decode_enum_associated_enumpty_value branch May 4, 2023 09:21
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.

How to encode empty tags as enum based on name
3 participants