Xcode16 and testing store.receive
with a case ...(Result<Void, Error>)
action
#3381
-
DescriptionHi there’s an issue with Xcode16 and testing @Reducer
struct Feature: Reducer {
@ObservableState
struct State: Equatable {}
enum Action {
case onAppear
// Will compile with other than `Void`
case voidResult(Result<Void, Error>)
}
var body: some Reducer<State, Action> {
Reduce<State, Action> { state, action in
switch action {
case .onAppear:
return .run { send in
await send(.voidResult(.success(())))
}
case .voidResult:
return .none
}
}
}
} Test which fails to compile: final class ResultTestFailTests: XCTestCase {
@MainActor
func testVoidResult() async {
let store = TestStore(initialState: Feature.State()) {
Feature()
}
await store.send(.onAppear)
// Build fails
await store.receive(\.voidResult.success)
// Build succeed
// await store.receive(\.voidResult)
}
Error (partial):
Minimal project reproducing this (by testing - CMD+U) Checklist
Expected behaviorNo response Actual behaviorNo response Reproducing projecthttps://github.com/oronbz/tca-xcode16-buildfails-voidresulttest The Composable Architecture version information1.15.0 Destination operating systemiOS 18 Xcode version informationVersion 16.0 (16A242) Swift Compiler version informationNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This is a duplicate of:
And unfortunately a bug in Swift, not the library. As such I'm going to convert to a discussion, and I'd encourage folks encountering the issue to submit it to Apple's Swift repo. Unfortunately it doesn't look like the original report followed up with a link to an Apple issue, so I'm not sure where/if it was filed. |
Beta Was this translation helpful? Give feedback.
-
related to: swiftlang/swift#76120 |
Beta Was this translation helpful? Give feedback.
This is a duplicate of:
And unfortunately a bug in Swift, not the library. As such I'm going to convert to a discussion, and I'd encourage folks encountering the issue to submit it to Apple's Swift repo. Unfortunately it doesn't look like the original report followed up with a link to an Apple issue, so I'm not sure where/if it was filed.