Skip to content

Commit a575a08

Browse files
committed
Add regression test
1 parent 9db2747 commit a575a08

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

tests/run-macros/i8745b/Macro_1.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import scala.quoted._
2+
3+
object Companion {
4+
def fun(first: String): String = "anything"
5+
}
6+
7+
object Macro {
8+
inline def mac(inline tree: String): String = ${ macImpl('tree) }
9+
def macImpl(tree: Expr[String])(using qctx: QuoteContext): Expr[String] = {
10+
tree match {
11+
case vv @ '{ ($s: Companion.type).fun($arg) } => arg
12+
case _ => ???
13+
}
14+
}
15+
}

tests/run-macros/i8745b/Test_2.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Macro._
2+
3+
@main def Test() = { //hello
4+
import Companion._
5+
mac(fun("blah"))
6+
}

0 commit comments

Comments
 (0)