Skip to content

Commit 5ad8293

Browse files
committed
Add test
Test does not compile with type annotations uncommented.
1 parent 0a12ad3 commit 5ad8293

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import scala.quoted._
2+
3+
object Macro {
4+
inline def t2[T0, T1](t0: T0, t1: T1)/*: (T0, T1) */ = ${ impl2('{t0}, '{t1}) }
5+
6+
def impl2[T0: Type, T1: Type](t0: Expr[T0], t1: Expr[T1]) given (qctx: QuoteContext)/*: Expr[(T0, T1)]*/ = {
7+
import qctx.tasty._
8+
import util._
9+
10+
val seq = List(t0, t1)
11+
val res = seq.toExprOfTuple
12+
res//.cast[(T0, T1)]
13+
}
14+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
object Test extends App {
2+
val t2 = Macro.t2(23, "foo")
3+
val t2a/*: (Int, String)*/ = t2
4+
assert(t2a == (23, "foo"))
5+
}

0 commit comments

Comments
 (0)