Skip to content

does not match '{ new String($x: Array[Byte]) } since 3.3.1-RC1 #17606

@xuwei-k

Description

@xuwei-k

Compiler version

OK

  • 3.2.2
  • 3.3.0
  • 3.3.1-RC1-bin-20230321-d36cd2d-NIGHTLY

NG

  • 3.3.1-RC1-bin-20230322-1f574e8-NIGHTLY
  • 3.3.1-RC1
  • 3.3.1-RC1-bin-20230524-5262680-NIGHTLY

Minimized code

A.scala

package example

import scala.quoted.Expr
import scala.quoted.Quotes

object A {
  inline def f(inline a: Any): Boolean = ${ impl('a) }

  def impl(a: Expr[Any])(using Quotes): Expr[Boolean] = {
    a match {
      case '{ new String($x: Array[Byte]) } =>
        '{ true }
      case _ =>
        '{ false }
    }
  }
}

Main.scala

package example

object Main {
  def main(args: Array[String]): Unit = {
    val x = A.f(new String(Array.empty[Byte]))
    println(x)
  }
}

Output

false

Expectation

print true

Note

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions