CoreOffice / XMLCoder

Easy XML parsing using Codable protocols in Swift
https://coreoffice.github.io/XMLCoder/
MIT License
797 stars 109 forks source link

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

Closed Alkenso closed 1 year ago

Alkenso commented 1 year ago

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 commented 1 year ago

@MaxDesiatov , please comment or approve the PR

MaxDesiatov commented 1 year ago

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

Alkenso commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

@Joannis Please re-run failed job

Alkenso commented 1 year ago

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

Joannis commented 1 year ago

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