Skip to content

Commit f50a6be

Browse files
Merge pull request #10248 from dotty-staging/fix-#10215
Fix #10215: Take .tasty files as arguments for -from-tasty compilation
2 parents 6443cba + 02c603a commit f50a6be

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

compiler/src/dotty/tools/dotc/fromtasty/Debug.scala

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@ object Debug {
3737
val fromTastyOut = Files.createDirectory(tmpOut.resolve("from-tasty"))
3838

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

4646
val fromTastyArgs =
4747
"-from-tasty" ::
4848
"-d" :: fromTastyOut.toString ::
4949
insertClasspathInArgs(args.filterNot(_.endsWith(".scala")).toList, fromSourcesOut.toString) :::
50-
classes
50+
tastyFiles
5151

52-
println("Compiling TASTY from .class sources")
52+
println("Compiling from .tasty sources")
5353
val compilation2 = dotc.Main.process(fromTastyArgs.toArray)
5454

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

6365
Directory(tmpOut).deleteRecursively()

project/scripts/cmdTests

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ rm $OUT/A.scala
4848
"$SBT" "scalac -classpath $OUT1 -d $OUT1 $OUT/B.scala" > "$tmp" 2>&1 || echo "ok"
4949
grep -qe "B.scala:2:7" "$tmp"
5050

51+
echo "testing -Ythrough-tasty"
52+
clear_out "$OUT"
53+
"$SBT" ";scalac -Ythrough-tasty $SOURCE"
5154

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

0 commit comments

Comments
 (0)