Skip to content

Commit 9a13214

Browse files
authored
Merge pull request #10117 from dotty-staging/fix-tasty-inspector-example-project
use new api for tasty inspector test
2 parents df7aa25 + 69534be commit 9a13214

File tree

1 file changed

+19
-3
lines changed
  • sbt-dotty/sbt-test/sbt-dotty/tasty-inspector-example-project/app

1 file changed

+19
-3
lines changed

sbt-dotty/sbt-test/sbt-dotty/tasty-inspector-example-project/app/Main.scala

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,32 @@ package hello
33
import scala.quoted._
44
import scala.tasty.inspector.TastyInspector
55

6+
import scala.jdk.StreamConverters._
7+
8+
import java.nio.file.{Path, Files, Paths, FileSystems}
9+
610
object Main extends App {
711

812
val inspector = new TastyInspector {
9-
protected def processCompilationUnit(using QuoteContext)(root: qctx.tasty.Tree): Unit = {
10-
import qctx.tasty._
13+
protected def processCompilationUnit(using QuoteContext)(root: qctx.reflect.Tree): Unit = {
14+
15+
import qctx.reflect._
1116
val tastyStr = root.show
1217
println(tastyStr)
1318
}
1419
}
1520

16-
inspector.inspect("", List("lib.Foo"))
21+
private def walk(f: Path): LazyList[Path] = Files.walk(f).toScala(LazyList)
22+
23+
locally {
24+
25+
val `lib/Foo.tasty` = FileSystems.getDefault.getPathMatcher("glob:**/lib/Foo.tasty")
26+
val pwd = Paths.get("")
27+
28+
val tastyFiles = for p <- walk(pwd) if `lib/Foo.tasty`.matches(p) yield p.toString
29+
30+
inspector.inspectTastyFiles(List(tastyFiles.head))
31+
32+
}
1733

1834
}

0 commit comments

Comments
 (0)