Open
Description
Compiler version
3.2.2, 3.3.0-RC4
Minimized code
trait Foo[A]
object Foo:
trait Codec[A] extends Foo[A]
object Codec:
inline def derived[A]: Codec[A] = ???
end Foo
trait Bar[A]
object Bar:
trait Codec[A] extends Bar[A]
object Codec:
inline def derived[A]: Codec[A] = ???
end Bar
final case class FooBar() derives Foo.Codec, Bar.Codec
Output
The code above fails to compile with the following error:
[error] 15 |final case class FooBar() derives Foo.Codec, Bar.Codec
[error] | ^^^^^^^^^
[error] | duplicate type class derivation for Codec
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:
type BarCodec[A] = Bar.Codec[A]
final case class FooBar() derives Foo.Codec, BarCodec
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?