diff --git a/sbt-dotty/sbt-test/sbt-dotty/tasty-inspector-example-project/app/Main.scala b/sbt-dotty/sbt-test/sbt-dotty/tasty-inspector-example-project/app/Main.scala index 00a95678753b..e6503fddc2ce 100644 --- a/sbt-dotty/sbt-test/sbt-dotty/tasty-inspector-example-project/app/Main.scala +++ b/sbt-dotty/sbt-test/sbt-dotty/tasty-inspector-example-project/app/Main.scala @@ -3,16 +3,32 @@ package hello import scala.quoted._ import scala.tasty.inspector.TastyInspector +import scala.jdk.StreamConverters._ + +import java.nio.file.{Path, Files, Paths, FileSystems} + object Main extends App { val inspector = new TastyInspector { - protected def processCompilationUnit(using QuoteContext)(root: qctx.tasty.Tree): Unit = { - import qctx.tasty._ + protected def processCompilationUnit(using QuoteContext)(root: qctx.reflect.Tree): Unit = { + + import qctx.reflect._ val tastyStr = root.show println(tastyStr) } } - inspector.inspect("", List("lib.Foo")) + private def walk(f: Path): LazyList[Path] = Files.walk(f).toScala(LazyList) + + locally { + + val `lib/Foo.tasty` = FileSystems.getDefault.getPathMatcher("glob:**/lib/Foo.tasty") + val pwd = Paths.get("") + + val tastyFiles = for p <- walk(pwd) if `lib/Foo.tasty`.matches(p) yield p.toString + + inspector.inspectTastyFiles(List(tastyFiles.head)) + + } }