Skip to content

Instantly share code, notes, and snippets.

@zeptometer
Created June 3, 2023 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeptometer/d1724f6fdc82d2ff23868ec50aea539c to your computer and use it in GitHub Desktop.
Save zeptometer/d1724f6fdc82d2ff23868ec50aea539c to your computer and use it in GitHub Desktop.
Issue-17105 test case
// Macro_1.scala
import scala.quoted.*
inline def testExpr(inline body: Any) = ${ testExprImpl('body) }
def testExprImpl(body: Expr[Any])(using Quotes): Expr[String] =
body match
case '{ def g(y: Int) = "hello" * y; $a(g): String } =>
'{ $a((z:Int) => "this is " + z.toString()) }
case _ => Expr("not matched")
// Test_2.scala
def app =
testExpr { def f(x: Int) = "hello" * x; f(0) + "bye" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment