Skip to content

Quoting type in a pattern doesn't work with higher-kinded types #10864

Closed
@IndiscriminateCoding

Description

@IndiscriminateCoding

Minimized code

T.scala:

import scala.quoted._

case class T(t: Type[_])

object T {
  def impl[T <: AnyKind](using tt: Type[T])(using Quotes): Expr[Unit] = {
    val t = T(tt)
    t.t match
      case '[x] => println("ok")
      case _ => println("not ok :(")
    '{}
  }

  inline def run[T <: AnyKind] = ${ impl[T] }
}

Run.scala:

@main
def run = T.run[List]

Output

not ok :(

Expectation

It is possible to match higher-kinded type in a macro quotation pattern.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions