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 3a5e137 commit 22b7264Copy full SHA for 22b7264
tests/pos-macros/i17445/Macro_1.scala
@@ -0,0 +1,21 @@
1
+package i17445
2
+
3
+import scala.quoted.*
4
+import scala.collection.*
5
6
7
+object Macro {
8
9
+ inline def changeIndexWhere[A](inline expr: A): A =
10
+ ${ changeIndexWhereImpl('expr) }
11
12
+ def changeIndexWhereImpl[A: Type](expr: Expr[A])(using Quotes): Expr[A] = {
13
+ import quotes.reflect.*
14
+ val r0 = expr.asTerm
15
+ val checker = new TreeMap() {}
16
+ println(r0.getClass().getSimpleName())
17
+ val r = checker.transformTerm(r0)(Symbol.spliceOwner)
18
+ r.asExprOf[A]
19
+ }
20
21
+}
tests/pos-macros/i17445/Test_2.scala
@@ -0,0 +1,9 @@
+//> using options -Ydebug
+def complileMe:Int =
+ Macro.changeIndexWhere {
+ val arr = Array(1, 2, 3)
+ val result = arr.indexWhere(_ == 2)
+ result
0 commit comments