Skip to content

HOAS quote pattern fails to match with def caprure #17105

@nicolasstucki

Description

@nicolasstucki

Compiler version

3.2

Minimized code

// Macro_1.scala import scala.quoted.* inline def test: String = ${ testExpr } def testExpr(using Quotes): Expr[String] = '{ def f(x: Int) = 1; f(3) } match case '{ def g(y: Int) = 1; $a(g): Int } => Expr(a.show) case _ => Expr("not matched")
// Test_2.scala def app = test

Output

scalac -Xprint:inlining Macro_1.scala Test_2.scala

package <empty> { final lazy module val Test_2$package: Test_2$package = new Test_2$package() @SourceFile("t/Test_2.scala") final module class Test_2$package() extends Object() { this: Test_2$package.type => private def writeReplace(): AnyRef = new scala.runtime.ModuleSerializationProxy(classOf[Test_2$package.type]) def app: String = "not matched":String } }

Expectation

The quote pattern should match and the result should be something like

 def app: String = "(g: Int => Int) => g(3)":String

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions