Closed
Description
Minimized code
sealed trait HList
case class HCons[+HD, TL <: HList](hd: HD, tl: TL) extends HList
case object HNil extends HList
private def flattenImpl[Xs <: HList](e: Expr[Xs])(using xt:Type[Xs], qctx:QuoteContext):
Expr[_ <:HList] = {
import qctx.reflect._
e match {
case '{HNil} =>
'{HNil}
//case '{HCons($h, $_)} =>
case '{HCons($h, HCons($_,$_))} =>
'{???}
case _ =>
report.error(s"flattenImpl ??????? ${e.show}", e); '{???}
}
}
transparent inline def flattenM[Xs <: HList](inline xs: Xs): Any = {
${flattenImpl('xs)}
}
val ffl00: HCons[Int, HCons[Int, HNil.type]] = flattenM( HCons(0, HCons(1, HNil)) )
Output
[error] -- Error: HyperParameters.scala:448:66
[error] 448 | val ffl00: HCons[Int, HCons[Int, HNil.type]] = flattenM( HCons(0, HCons(1, HNil)) )
[error] | ^^^^^^^^^^^^^^^^^^^^^^^^
[error] |flattenImpl ??????? automl.Recorder.HCons.apply[scala.Int, automl.Recorder.HCons[scala.Int, automl.Recorder.HNil]](0, automl.Recorder.HCons.apply[scala.Int, automl.Recorder.HNil.type](1, automl.Recorder.HNil))
[error] | This location contains code that was inlined from HyperParameters.scala:448
Expectation
I expected the match to succeed. If I use the more general case that is commented out, the match occurs.