Skip to content

Incremental compilation in Scala 3.5.0 compiles too many files #21594

Closed as not planned
@OndrejSpanel

Description

@OndrejSpanel

Compiler version

3.5.0

(I have tested the issue does not exists with (2.13.14, 3.0.0. 3.2.0 or 3.4.2)

Minimized code

ClassA.scala:

object ClassA {
  def a: String = "b"
}

Main.scala:

object Main {
  def main(args: Array[String]): Unit = {
    println("Hello world!x")
  }
}

build.sbt:

scalaVersion := "3.5.0"
  • From SBT use compile
  • Change "b" in ClassA.scala to "a"
  • From SBT use compile again.

Output

[info] compiling 2 Scala sources to C:\Dev\inc\target\scala-3.5.0\classes ...

Expectation

Only 1 file should be compiled. There is no reason to compile both. This is the output I get with all previous compiler versions:

[info] compiling 1 Scala source to C:\Dev\inc\target\scala-3.4.2\classes ...

Note

I observe much worse incremental compilation in my real world project. Even when doing just a small change in my code, most of files are compiled and compilation takes very long. It is hard to be sure the issue here is representative of the real issue, but it certainly looks suspicious and strange.

Metadata

Metadata

Assignees

No one assigned

    Labels

    itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions