Skip to content

Commit 832b140

Browse files
Merge pull request #6337 from dotty-staging/fix-6201
Fix #6201: Add test
2 parents 2eebb70 + 9b958c0 commit 832b140

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
object Test {
2+
def main(args: Array[String]): Unit = {
3+
assert(isHello(strip("hello")))
4+
assert(!isHello(strip("bonjour")))
5+
}
6+
}

0 commit comments

Comments
 (0)