TestStore type inference not working #1028
Replies: 2 comments 2 replies
-
If Xcode couldn't infer types properly you'd be seeing a build failure, not just a failure in Xcode's features. Are you seeing a build failure? If not, I'm surprised you've never seen this before, as Xcode's autocomplete often fails, especially in test targets. Narrowing down the cause and reporting bugs is the only way to fix it. |
Beta Was this translation helpful? Give feedback.
-
I've tried blowing away my entire derived data folder and letting Xcode re-index but still no luck. Strangely, changing to this: let store = TestStore<SessionState, SessionState, SessionAction, SessionAction, SessionEnvironment>(...) Makes no difference. But this: let store: TestStore<SessionState, SessionState, SessionAction, SessionAction, SessionEnvironment> = .init(...) Does work and I'm able to auto-complete again. Its not very ergonomic though. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Since updating to Xcode 13.3 the compiler no longer seems to be able to infer the type of our
TestStore
in any of our main app target tests, which makes it very hard to use without any auto-completion of actions in send and receive calls or state properties inside assertion closures.Can anyone think of what might be breaking this? I spun up a new project and added TCA and an example test and it infers the
TestStore
type just fine but I don't know what it could be about our project causing this to fail.For example:
I'm being as explicit as I can here. This is taken from one of our tests. In this example:
SessionState
is a static var of typeSessionState
.SessionEnvironment.failing
is a static var of typeSessionEnvironment
sessionReducer
it correctly shows me the typeReducer<SessionState, SessionAction, SessionEnvironment>
Yet when I option-click on
store
it gives me a type definition oflet store: <<error type>>
which means it cannot infer the type.This only seems to be a problem in our main app target. All of the feature tests in our SPM feature module test targets are working as expected.
Beta Was this translation helpful? Give feedback.
All reactions