Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions compiler/src/dotty/tools/dotc/fromtasty/Debug.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ object Debug {
val fromTastyOut = Files.createDirectory(tmpOut.resolve("from-tasty"))

val extensions = List("tasty", "hasTasty").map(_.toLowerCase)
val classes = Directory(fromSourcesOut).walk.filter(x => x.isFile && extensions.exists(_ == x.extension.toLowerCase)).map { x =>
val source = x.toString
// transform foo/bar/Baz.hasTasty into foo.bar.Baz
source.substring(fromSourcesOut.toString.length + 1, source.length - x.extension.length - 1).replace('/', '.')
}.toList
val tastyFiles =
Directory(fromSourcesOut).walk
.filter(x => x.isFile && extensions.exists(_ == x.extension.toLowerCase))
.map(_.toString)
.toList

val fromTastyArgs =
"-from-tasty" ::
"-d" :: fromTastyOut.toString ::
insertClasspathInArgs(args.filterNot(_.endsWith(".scala")).toList, fromSourcesOut.toString) :::
classes
tastyFiles

println("Compiling TASTY from .class sources")
println("Compiling from .tasty sources")
val compilation2 = dotc.Main.process(fromTastyArgs.toArray)

if (compilation2.hasErrors) {
Expand All @@ -58,6 +58,8 @@ object Debug {
// In this case we do not delete the generated class files to allow further debugging.
// For example `dotc -decompile` on one of the intermediate class files.
sys.exit(1)
} else {
println("Recompilation successful")
}

Directory(tmpOut).deleteRecursively()
Expand Down
3 changes: 3 additions & 0 deletions project/scripts/cmdTests
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ rm $OUT/A.scala
"$SBT" "scalac -classpath $OUT1 -d $OUT1 $OUT/B.scala" > "$tmp" 2>&1 || echo "ok"
grep -qe "B.scala:2:7" "$tmp"

echo "testing -Ythrough-tasty"
clear_out "$OUT"
"$SBT" ";scalac -Ythrough-tasty $SOURCE"

## Disabled because of flakeyness, should be changed to not depend on sbt
# echo "running Vulpix meta test"
Expand Down