tvOSBrowser
tvOSBrowser copied to clipboard
I've extracted from TCA's [#1086](https://github.com/pointfreeco/swift-composable-architecture/issues/1086) the following minimal suite that doesn't pass when built in `Release` mode:
I've extracted from TCA's #1086 the following minimal suite that doesn't pass when built in Release mode:
import CasePaths
import XCTest
public enum RootAction: Equatable {
case branch(BranchAction)
// case noop // Add this and extraction succeeds
}
public enum BranchAction: Equatable {
case firstAction(Bool)
case secondAction(Bool)
case leaf(LeafAction) // Remove this and extraction succeeds
}
public enum LeafAction: Equatable {
case value(Value) // Or case value(Any) with explicit `Equatable` conformance.
}
public struct Value: Equatable {
var value: Any
public static func == (lhs: Value, rhs: Value) -> Bool { true }
}
class CasePathIssueTests: XCTestCase {
func testFirst() throws {
XCTAssertEqual(
(/RootAction.branch).extract(from: .branch(.firstAction(true))),
.firstAction(true)
)
}
func testSecond() throws {
XCTAssertEqual(
(/RootAction.branch).extract(from: .branch(.secondAction(true))),
.secondAction(true)
)
}
}
A few comments:
- It passes in
Debugmode - If
.firstActionhas no associated value, it becomes the one that fails to extract, andsecondpasses.
I'm not knowledgeable enough with runtime and the intricacies of the extraction algorithm to fix this issue.
Originally posted by @tgrapperon in https://github.com/pointfreeco/swift-case-paths/issues/71