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

"Failed to cast" error with Remote.Cons #191

Closed
TomasMikula opened this issue May 31, 2022 · 1 comment · Fixed by #197
Closed

"Failed to cast" error with Remote.Cons #191

TomasMikula opened this issue May 31, 2022 · 1 comment · Fixed by #197
Assignees
Labels
bug Something isn't working

Comments

@TomasMikula
Copy link

The following test case (when added to PersistentExecutorSpec)

    testFlow("cons") {
      ZFlow(Remote(1))
        .map(Remote.Cons(Remote(Nil), _))
    } { result =>
      assertTrue(result == List(1))
    },

results in

Exception in thread "zio-fiber-28" zio.FiberFailure: Failed to evaluate remote: Failed to cast Primitive((),unit) to schema Sequence(Primitive(int,Chunk()), List)

@vigoo vigoo self-assigned this May 31, 2022
@vigoo vigoo added the bug Something isn't working label May 31, 2022
@vigoo
Copy link
Contributor

vigoo commented Jun 1, 2022

If you explicitly give the type of Nil it works:

testFlow("cons") {
      ZFlow(Remote(1))
        .map(Remote.Cons(Remote[List[Int]](Nil), _))
    } { result =>
      assertTrue(result == List(1))
    },

without that the
implicit val nil: Schema[Nil.type] = singleton(Nil)
is picked up from zio-schema instead of a sequence of int schema.

I think this is a zio-schema issue similar to another I already fixed in it regarding Left and Right was not encoded the same way as an Either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants