-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Typeclass derivation fails with no useful information #18166
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
Comments
Open CB failures of zio/zio-config might be related to that. |
I think it might be rather a regression in one of used libraries, if I need to guess, then I'd bet on And if fact it matches a source code for that version: https://github.com/circe/circe/blob/505fa69c73306ce98b67f4d224799774a5ba3e67/modules/core/shared/src/main/scala-3/io/circe/Derivation.scala#L16-L17 What's interesting this Derivation is deprecated since 0.14.4, so they're probably aware of this kind of issues, however the given snippet would still fail to compile even when using latest versions of libraries. There no version of Scala 3 in which it would successfully compile |
I believe the relevant circe issue is circe/circe#2126, I'm not sure if there's actually something we can do differently in the compiler since we don't know what the inline def is trying to achieve in general so it's hard for us to give more precise error messages. perhaps we could let the authors of the inline def customize the error that is reported in cases like this, but full auto derivation is just the wrong default in circe. |
Thanks. Now I understand. Because Caliban 2.2.0 moved from Circe to jsoniter, GraphQLRequest and other classes do not provide the implicit Circe encoders/decoders anymore. This is not obvious. |
It's not the compiler that tries that, it's the type class derivation macro library that circe uses (kitten, maybe?). Once we move to Scala 3 built in typeclass derivation, it will be up the the compiler. And hopefully that will be more predictable.. |
circe implements typeclass derivation for scala 3 by itself via inline defs: https://github.com/circe/circe/blob/series/0.14.x/modules/core/shared/src/main/scala-3/io/circe/derivation/package.scala
Is this referring to an upcoming feature? |
Ah indeed. Not sure why it tried to call itself in a cycle then. |
What is the definition of |
You can also try |
With caliban 2.0.0, the code compiles and works. With 2.2.0, it fails and the recursive error message is not helpful at all.
Compiler version
3.3.0
Minimized example
build.sbt
Expectation
At least an usable error message pointed out the source of the problem in the code because increasing -Xmax-inlines has no effect.
The text was updated successfully, but these errors were encountered: