Skip to content

Commit

Permalink
Reproduce scala#12669
Browse files Browse the repository at this point in the history
However, the A.tasty and B_rename.tasty files from the repo in the issue
don't seem to load inside the dotty repo ???
  • Loading branch information
Issac Kurian committed Nov 29, 2022
1 parent 5c9b6e2 commit ed6132b
Show file tree
Hide file tree
Showing 21 changed files with 51 additions and 0 deletions.
Binary file added tasty-inspector/src/resources/tasties/A.tasty
Binary file not shown.
Binary file not shown.
Binary file added tasty-inspector/src/resources/tasties/Array.tasty
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added tasty-inspector/src/resources/tasties/B_rename.tasty
Binary file not shown.
Binary file added tasty-inspector/src/resources/tasties/Box.class
Binary file not shown.
Binary file added tasty-inspector/src/resources/tasties/Box.tasty
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
51 changes: 51 additions & 0 deletions tasty-inspector/src/scala/tasty/inspector/RunTastyInspector.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package scala.tasty.inspector

import scala.quoted.*

import scala.io.Source

import java.io.File
import java.nio.file.Path
import java.nio.file.Files
import java.nio.file.Paths
import java.text.Collator
import java.util.stream.Collectors
import scala.jdk.CollectionConverters._

import java.net.URLClassLoader


object StacktracesInspector extends Inspector:
override def inspect(using q: Quotes)(tastys: List[Tasty[quotes.type]]): Unit =
import q.reflect.*

for tasty <- tastys do
println("AST:")
println(tasty.ast.getClass)

def main(args: Array[String]): Unit =
val files: List[Path] = Files.walk(Paths.get("src/resources")).collect(Collectors.toList).asScala.toList.filter(_.toString.endsWith("tasty"))

val (arr, rest) = files.partition(_.toString.contains("Array"))


rest.foreach { f =>
println("Class Name:")
println(f.toString)
TastyInspector.inspectTastyFiles(List(f.toAbsolutePath.toString))(StacktracesInspector)
println()
}


println("How many Array.tasty files are there:")
println(arr.size)
println("How many Array.tasty files with different size are there: ")
println(arr.map(f => Files.readAllBytes(f).toArray.size).distinct.size)

arr.foreach { f =>
println("Class Name:")
println(f.toString)
TastyInspector.inspectTastyFiles(List(f.toAbsolutePath.toString))(StacktracesInspector)
println()
}

0 comments on commit ed6132b

Please sign in to comment.