We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2eebb70 + 9b958c0 commit 832b140Copy full SHA for 832b140
tests/run-with-compiler/i6201/macro_1.scala
@@ -0,0 +1,15 @@
1
+import scala.quoted._
2
+import scala.tasty._
3
+
4
+inline def (inline x: String) strip: String =
5
+ ${ stripImpl(x) }
6
7
+def stripImpl(x: String)(implicit refl: Reflection): Expr[String] =
8
+ x.stripMargin.toExpr
9
10
+inline def isHello(inline x: String): Boolean =
11
+ ${ isHelloImpl(x) }
12
13
+def isHelloImpl(x: String)(implicit refl: Reflection): Expr[Boolean] =
14
+ if (x == "hello") true.toExpr else false.toExpr
15
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")))
+ }
+}
0 commit comments