Open kyri-petrou opened 1 year ago
same on 3.3.1
- final case class FooBar() derives Foo.Codec, Bar.Codec
+ final case class FooBar()
+ object FooBar:
+ given FooCodec: Foo.Codec[FooBar] = Foo.Codec.derived
+ given BarCodec: Bar.Codec[FooBar] = Bar.Codec.derived
We have a similar issue with
object FooBar:
given Foo.Codec[FooBar] = Foo.Codec.derived
given Bar.Codec[FooBar] = Bar.Codec.derived
This is part of the current spec. It is a consequence of the names we choose when desugaring. We can't change the generated names without breaking binary compatibility. To make this work we would need a change in the spec with a good migration path.
Compiler version
3.2.2, 3.3.0-RC4
Minimized code
Output
The code above fails to compile with the following error:
Expectation
I'm not sure if this is a bug or the intended operation. A workaround is to alias one of the
Codec
s. e.g., the following works:If this is the intended operation, would it make sense for the compiler to auto-generate the alias, or if that's not possible, provide the workaround in the error description?