Compiler is unable to type-check this expression in reasonable time #1293
Replies: 3 comments 4 replies
-
Can you show us what the old style reducer looks like? That might help us understand what it should look like in the new style. |
Beta Was this translation helpful? Give feedback.
-
Your Scope(state: \State.editorStep, action: /.self) {
Scope(state: /Step.imageInput, action: /Action.imageInput) {
ImageInput(mainQueue: mainQueue, onDropImage: onDropImage)
}
Scope(state: /Step.imageProcessing, action: /Action.imageProcessing) {
ImageProcessing(renderer: renderer, colorClamp: colorClamp)
}
} |
Beta Was this translation helpful? Give feedback.
-
Ah that did the trick thanks @tgrapperon! It even works for the two nested scopes. It just messes a bit with syntax highlighting unfortunately haha. Might be that this could still be improved by using ifCaseLet? But not sure. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey all! Really excited about the upcoming ReducerProtocol. I was migrating to the new stuff when I hit the following compiler error:
The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
My new reducer looks as follows:
The problem probably lies with the nested scope I have in there? Maybe this is not possible with the new approach I'm not a 100% sure.
When I add a little hint to the reducer's first scope (above) I get the following new error message:
Generic parameter 'Child' could not be inferred
(for the first scope) I guess this makes sense, since the two child scopes have 3 generics,ParentState
andParentAction
which are equal, but their Child generic is different,ImageInput
vsImageProcessing
.Just wanted to point this out and see if there's any way around this? I can of course apply the parent scope to both reducers individually, but maybe there's a nicer way to go about it?
EDIT: Actually adding Scope to both doesn't work either, since this results in the error:
Key path cannot refer to static member 'imageInput'
The reason the state looks like this is that.
ImageProcessing.State
also containsSettings.State
but I want to pass this along from higher up to propagate changes made in a different feature. So in this case not 100% sure how to migrate this currently :) Help would be appreciated!Beta Was this translation helpful? Give feedback.
All reactions