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

Compilation fails in Scala 3 when deriving Reusability for case classes with multiple parameter groups #1075

Open
rpiaggio opened this issue Jul 29, 2022 · 1 comment

Comments

@rpiaggio
Copy link
Collaborator

Attempting to compile the following code in Scala 3

  final case class Foo(bar: Int)(val ctx: String)

  implicit val reuse: Reusability[Foo] = Reusability.derive

results in

[error] 108 |  implicit val reuse: Reusability[Foo] = Reusability.derive
[error]     |                                         ^^^^^^^^^^^^^^^^^^
[error]     | no implicit values were found that match type deriving.Mirror{
[error]     |   MirroredType = explore.targeteditor.ElevationPlotSemester.Foo; 
[error]     |     MirroredMonoType = explore.targeteditor.ElevationPlotSemester.Foo
[error]     |   ; MirroredElemTypes <: Tuple
[error]     | }

The expected behavior is that only the first parameter group is considered for reusability, as it does in Scala 2

@matthughes
Copy link
Contributor

I think this is a Scala bug (if at all) not with this library. Compiling this with 3.2.0 we get a more helpful message:

[error] 43 |  implicit val reuse: Reusability[Foo] = Reusability.derive
[error]    |                                         ^^^^^^^^^^^^^^^^^^
[error]    |Failed to synthesize an instance of type deriving.Mirror{
[error]    |  MirroredType = Foo;
[error]    |    MirroredMonoType = Foo
[error]    |  ; MirroredElemTypes <: Tuple
[error]    |}:
[error]    |	* class Foo is not a generic product because it takes more than one parameter list
[error]    |	* class Foo is not a generic sum because it is not a sealed class
[error]    |----------------------------------------------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants