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

Mirror.Of is not implemented for named tuples #22382

Open
smarter opened this issue Jan 15, 2025 · 0 comments
Open

Mirror.Of is not implemented for named tuples #22382

smarter opened this issue Jan 15, 2025 · 0 comments
Assignees
Labels
area:named-tuples Issues tied to the named tuples feature. area:typeclass-derivation itype:bug

Comments

@smarter
Copy link
Member

smarter commented Jan 15, 2025

Compiler version

3.6.2

Minimized code

import scala.language.experimental.namedTuples
import scala.deriving.*

summon[Mirror.Of[(Int, String)]] // OK

summon[Mirror.Of[(foo: Int, bla: String)]] // error

Output

  |No given instance of type scala.deriving.Mirror.Of[(foo : Int, bar : String)] was found for parameter x of method summon in object Predef. Failed to synthesize an instance of type scala.deriving.Mirror.Of[(foo : Int, bar : String)]:
  |     * class Any is not a generic product because it is not a case class
  |     * class Any is not a generic sum because it is not a sealed class

Expectation

Just like regular tuples, named tuples should have mirror instances because they are product types and mirrors allow for uniform meta-programming on sums and products types.

@smarter smarter added area:named-tuples Issues tied to the named tuples feature. itype:bug labels Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:named-tuples Issues tied to the named tuples feature. area:typeclass-derivation itype:bug
Projects
None yet
Development

No branches or pull requests

3 participants