Describe the bug
Hello guys, I have a project using CasePaths with version 0.1.3 and updating it with a huge leap into 0.8.1. After the update enum with the associated value of AnyHashable will fail to extract. The pattern in enum looks like this:
enum ParentAction {
case loadPage
case childrenAction(id: AnyHashable, action: ChildrenAction)
}
To Reproduce
We can reproduce this by running tests in CasePathTests and changing the associated value from String to AnyHashable in this test
func testPathExtractFromOptionalRoot() {
enum Authentication {
case authenticated(token: AnyHashable) // change from String to AnyHashable
case unauthenticated
}
let root: Authentication? = .authenticated(token: "deadbeef")
let path: CasePath<Authentication?, String> = /Authentication.authenticated
for _ in 1...2 {
let actual = path.extract(from: root)
XCTAssertEqual(actual, "deadbeef") // XCTAssertEqual failed: ("nil") is not equal to ("Optional("deadbeef")")
}
}
Expected behavior
The extracted result should be not nil in the latest version and on (version 0.1.3), The tests above succeed both for the associated value String and AnyHashable
Describe the bug Hello guys, I have a project using
CasePaths
with version0.1.3
and updating it with a huge leap into0.8.1
. After the update enum with the associated value ofAnyHashable
will fail to extract. The pattern in enum looks like this:To Reproduce We can reproduce this by running tests in
CasePathTests
and changing the associated value fromString
toAnyHashable
in this testExpected behavior The extracted result should be not nil in the latest version and on (version 0.1.3), The tests above succeed both for the associated value String and AnyHashable
Environment