diff --git a/tests/run-with-compiler/i6201/macro_1.scala b/tests/run-with-compiler/i6201/macro_1.scala new file mode 100644 index 000000000000..85fc35d598e6 --- /dev/null +++ b/tests/run-with-compiler/i6201/macro_1.scala @@ -0,0 +1,15 @@ +import scala.quoted._ +import scala.tasty._ + +inline def (inline x: String) strip: String = + ${ stripImpl(x) } + +def stripImpl(x: String)(implicit refl: Reflection): Expr[String] = + x.stripMargin.toExpr + +inline def isHello(inline x: String): Boolean = + ${ isHelloImpl(x) } + +def isHelloImpl(x: String)(implicit refl: Reflection): Expr[Boolean] = + if (x == "hello") true.toExpr else false.toExpr + diff --git a/tests/run-with-compiler/i6201/test_2.scala b/tests/run-with-compiler/i6201/test_2.scala new file mode 100644 index 000000000000..cb8c2053e673 --- /dev/null +++ b/tests/run-with-compiler/i6201/test_2.scala @@ -0,0 +1,6 @@ +object Test { + def main(args: Array[String]): Unit = { + assert(isHello(strip("hello"))) + assert(!isHello(strip("bonjour"))) + } +} \ No newline at end of file