File tree 1 file changed +27
-0
lines changed
tests/run-custom-args/tasty-inspector
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ import scala .quoted .*
2
+ import scala .tasty .inspector .*
3
+
4
+ class MyTest :
5
+ List () match
6
+ case Nil => 1
7
+ case _ :: tail => 2
8
+
9
+ class TestInspector extends Inspector :
10
+ override def inspect (using Quotes )(tastys : List [Tasty [quotes.type ]]): Unit =
11
+ import quotes .reflect .*
12
+ val tree : Tree = tastys(0 ).ast
13
+ val traverser = new TreeTraverser {}
14
+ traverser.traverseTree(tree)(tree.symbol)
15
+
16
+ object Test {
17
+ def main (args : Array [String ]): Unit = {
18
+ // Artefact of the current test infrastructure
19
+ // TODO improve infrastructure to avoid needing this code on each test
20
+ val classpath = dotty.tools.dotc.util.ClasspathFromClassloader (this .getClass.getClassLoader).split(java.io.File .pathSeparator).find(_.contains(" runWithCompiler" )).get
21
+ val allTastyFiles = dotty.tools.io.Path (classpath).walkFilter(_.extension == " tasty" ).map(_.toString).toList
22
+ val tastyFiles = allTastyFiles.filter(_.contains(" MyTest" ))
23
+
24
+ val inspect = new TestInspector ()
25
+ TastyInspector .inspectTastyFiles(allTastyFiles)(inspect)
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments