Skip to content

Commit 76542f8

Browse files
committed
Regression: fix compilation performance on Windows by caching isDirectory calls
Fixes #19924 backport to start-3.4.1
1 parent 54d67e0 commit 76542f8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/src/dotty/tools/io/PlainFile.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import java.nio.file.{InvalidPathException, Paths}
1313

1414
/** ''Note: This library is considered experimental and should not be used unless you know what you are doing.'' */
1515
class PlainDirectory(givenPath: Directory) extends PlainFile(givenPath) {
16-
override def isDirectory: Boolean = true
16+
override val isDirectory: Boolean = true
1717
override def iterator(): Iterator[PlainFile] = givenPath.list.filter(_.exists).map(new PlainFile(_))
1818
override def delete(): Unit = givenPath.deleteRecursively()
1919
}
@@ -78,7 +78,7 @@ class PlainFile(val givenPath: Path) extends AbstractFile {
7878
}
7979

8080
/** Is this abstract file a directory? */
81-
def isDirectory: Boolean = givenPath.isDirectory
81+
val isDirectory: Boolean = givenPath.isDirectory
8282

8383
/** Returns the time that this abstract file was last modified. */
8484
def lastModified: Long = givenPath.lastModified.toMillis

0 commit comments

Comments
 (0)