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

Case key paths for receiving test store actions cannot be compiled. #3541

Open
2 of 3 tasks
Kyome22 opened this issue Dec 25, 2024 · 0 comments
Open
2 of 3 tasks

Case key paths for receiving test store actions cannot be compiled. #3541

Kyome22 opened this issue Dec 25, 2024 · 0 comments
Labels
bug Something isn't working due to a bug in the library.

Comments

@Kyome22
Copy link
Contributor

Kyome22 commented Dec 25, 2024

Description

If the enum defined with associated values and its value type is Result with a success value of tuple, compiling a receiving action using case key paths will fail.
(Even if I implement it as written in Migrating 1.4, the build will fail, and the cause will not be clearly displayed in the log.)

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue or discussion.

Expected behavior

Compilation successes.

Actual behavior

Compilation fails.

Reproducing project

import ComposableArchitecture
import XCTest

@Reducer
struct SomeReducer {
    @ObservableState
    struct State: Equatable {}

    enum Action {
        case response(Result<(Bool, String), any Error>)
    }

    var body: some ReducerOf<Self> {
        EmptyReducer()
    }
}

final class SomeReducerTests: XCTestCase {
    @MainActor
    func test_sample() async {
        let store = TestStore(initialState: SomeReducer.State()) {
            SomeReducer()
        }
        await store.receive(\.response.failure) // cannot be compiled
    }
}

If you use a struct instead of a tuple, it will compile.

The Composable Architecture version information

1.17.0

Destination operating system

iOS 18

Xcode version information

Version 16.2 (16C5032a)

Swift Compiler version information

swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Target: arm64-apple-macosx14.0
@Kyome22 Kyome22 added the bug Something isn't working due to a bug in the library. label Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working due to a bug in the library.
Projects
None yet
Development

No branches or pull requests

1 participant