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.
1 parent a6b8a98 commit 8042c00Copy full SHA for 8042c00
tests/pos/i7887.scala
@@ -0,0 +1,7 @@
1
+def typed[A](given t: quoted.Type[A], qctx: quoted.QuoteContext): Unit = {
2
+ import qctx.tasty.{given, _}
3
+ '{
4
+ type T = $t
5
+ ${'{???}.cast[T]}
6
+ }
7
+}
tests/run-macros/i7887/Macro_1.scala
@@ -0,0 +1,17 @@
+def myMacroImpl(a: quoted.Expr[_])(given qctx: quoted.QuoteContext) = {
+ import qctx.tasty.{_, given}
+ def typed[A] = {
+ implicit val t: quoted.Type[A] = a.unseal.tpe.widen.seal.asInstanceOf[quoted.Type[A]]
+ ${a.unseal.seal.cast[T]}
8
9
10
+
11
+ typed
12
13
14
15
+inline def myMacro(a: => Any) = ${
16
+ myMacroImpl('a)
17
tests/run-macros/i7887/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ assert(myMacro(42) == 42)
0 commit comments