Skip to content

Failing incremental compilation, involving path-dependent type with type lambda bound #23573

@TomasMikula

Description

@TomasMikula

(Originally reported at sbt/zinc#1561.)

Compiler version

3.7.1

Minimized code

Module.scala

sealed trait Module:
  type F <: [_] =>> [_] =>> Any

  def get: F[String][Int] = ???

test.scala

def test(m: Module): m.F[String][Int] =
  m.get

build.sbt

ThisBuild / scalaVersion := "3.7.1"

Output

Initial clean compilation works, subsequent incremental one does not (notice the [success] and then the [error]):

 % sbt
[info] welcome to sbt 1.11.2 (Eclipse Adoptium Java 21)
[info] loading project definition from /Users/tomas/tmp/incremental-compilation-failure/project
[info] loading settings for project incremental-compilation-failure from build.sbt...
[info] set current project to incremental-compilation-failure (in build file:/Users/tomas/tmp/incremental-compilation-failure/)
[info] sbt server started at local:///Users/tomas/.sbt/1.0/server/437b6cde508c251f4dd9/sock
[info] started sbt server
sbt:incremental-compilation-failure> ~compile
[info] compiling 2 Scala sources to /Users/tomas/tmp/incremental-compilation-failure/target/scala-3.7.1/classes ...
[success] Total time: 2 s, completed Jul 19, 2025, 6:53:11 PM
[info] 1. Monitoring source files for incremental-compilation-failure/compile...
[info]    Press <enter> to interrupt or '?' for more options.
[info] Build triggered by /Users/tomas/tmp/incremental-compilation-failure/test.scala. Running 'compile'.
[info] compiling 1 Scala source to /Users/tomas/tmp/incremental-compilation-failure/target/scala-3.7.1/classes ...
[error] -- [E007] Type Mismatch Error: /Users/tomas/tmp/incremental-compilation-failure/test.scala:3:4 
[error] 3 |  m.get
[error]   |  ^^^^^
[error]   |  Found:    m.F[String][Int]
[error]   |  Required: m.F[String][Int]
[error]   |
[error]   | longer explanation available when compiling with `-explain`
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 1 s, completed Jul 19, 2025, 6:53:20 PM
[info] 2. Monitoring source files for incremental-compilation-failure/compile...
[info]    Press <enter> to interrupt or '?' for more options.

Note: I made a whitespace change to test.scala after the initial successful compilation, which resulted in the failure.

Expectation

The result of incremental compilation should be identical to a clean compile.

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