Skip to content

Compiler crashes on get the field names of case class. #16207

Open
@esse-byte

Description

@esse-byte

Compiler version

3.2.0, 3.2.1-RC4

Minimized code

import scala.compiletime.constValueTuple
import scala.deriving.Mirror.ProductOf

case class C(date: Int, time: Int)

inline def labelsOf[A](using p: ProductOf[A]): Tuple = constValueTuple[p.MirroredElemLabels]

val headers: List[String] = labelsOf[C].toList.map(_.toString)

Output (click arrow to expand)

exception while typing {
  val p$proxy1:

      scala.deriving.Mirror.Product{
        MirroredMonoType = C; MirroredType = C; MirroredLabel = ("C" : String);
          MirroredElemTypes = (Int, Int)
        ; MirroredElemLabels = (("date" : String), ("time" : String))
      }

   =
    C.$asInstanceOf[

        scala.deriving.Mirror.Product{
          MirroredMonoType = C; MirroredType = C; MirroredLabel = ("C" : String)
            ;
          MirroredElemTypes = (Int, Int);
            MirroredElemLabels = (("date" : String), ("time" : String))
        }

    ]
  {
    val Tuple_this: Tuple =
      (
        {
          val res: Tuple =
            {
              val x$1: ("date" : String) = "date"
              {
                val Tuple_this: ("time" : String) *: EmptyTuple.type =
                  {
                    val res: Tuple =
                      {
                        val x$1: ("time" : String) = "time"
                        {
                          val Tuple_this: EmptyTuple.type = EmptyTuple
                          runtime.Tuples.cons("time", Tuple_this).asInstanceOf[
                            ("time" : String) *: EmptyTuple.type
                          ]:("time" : String) *: EmptyTuple.type
                        }:Any *: Tuple
                      }
                    res.asInstanceOf[("time" : String) *: EmptyTuple.type]
                  }:("time" : String) *: EmptyTuple.type
                runtime.Tuples.cons("date", Tuple_this).asInstanceOf[
                  (("date" : String), ("time" : String))
                ]:(("date" : String), ("time" : String))
              }:Any *: Tuple
            }
          res.asInstanceOf[p$proxy1.MirroredElemLabels]
        }:p$proxy1.MirroredElemLabels
      :Tuple)
    (
      Tuple_this.productIterator.toList.asInstanceOf[
        scala.collection.immutable.List[Tuple.Union[(Tuple_this : Product)]]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions