Skip to content

Commit 58b5239

Browse files
committed
Remove both .tasty and .hasTasty files in sbt.
1 parent 4abbef1 commit 58b5239

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ object DottyPlugin extends AutoPlugin {
7979
}
8080
}
8181

82-
/** Patches the IncOptions so that .tasty files are pruned as needed.
82+
/** Patches the IncOptions so that .tasty and .hasTasty files are pruned as needed.
8383
*
8484
* This code is adapted from `scalaJSPatchIncOptions` in Scala.js, which needs
8585
* to do the exact same thing but for classfiles.
8686
*
8787
* This complicated logic patches the ClassfileManager factory of the given
88-
* IncOptions with one that is aware of .tasty files emitted by the Dotty
88+
* IncOptions with one that is aware of .tasty and .hasTasty files emitted by the Dotty
8989
* compiler. This makes sure that, when a .class file must be deleted, the
90-
* corresponding .tasty file is also deleted.
90+
* corresponding .tasty and .hasTasty file is also deleted.
9191
*/
9292
def dottyPatchIncOptions(incOptions: IncOptions): IncOptions = {
9393
val inheritedNewClassfileManager = incOptions.newClassfileManager
@@ -97,9 +97,8 @@ object DottyPlugin extends AutoPlugin {
9797
def delete(classes: Iterable[File]): Unit = {
9898
inherited.delete(classes flatMap { classFile =>
9999
val dottyFiles = if (classFile.getPath endsWith ".class") {
100-
val f = new File(classFile.getAbsolutePath.stripSuffix(".class") + ".tasty")
101-
if (f.exists) List(f)
102-
else Nil
100+
val prefix = classFile.getAbsolutePath.stripSuffix(".class")
101+
List(".tasty", ".hasTasty").map(x => new File(prefix + x)).filter(_.exists)
103102
} else Nil
104103
classFile :: dottyFiles
105104
})

0 commit comments

Comments
 (0)