Open
Description
This behavior has been for quite a while: I don't know exactly whether it is a bug.
Compiler version
3.7.2-RC1
Minimized code
project/build.properties
:
sbt.version=1.11.3
./build.sbt
:
ThisBuild / scalaVersion := "3.7.2-RC1"
val scala2Opts = Seq("-feature", "-language:implicitConversions", "-deprecation", "-Ytasty-reader")
val scala3Opts = Seq("-feature", "-language:implicitConversions", "-indent", "-Xwiki-syntax", "-Xmax-inlines", "128", "-new-syntax")
lazy val root = (project in file("."))
.settings(
name := "test",
organization := "test",
organizationName := "test",
version := "1.0",
maxErrors := 5,
scalaVersion := "3.7.2-RC1",
javacOptions ++= Seq("-source", "16"),
crossScalaVersions ++= Seq("2.13.16", "3.7.2-RC1"),
scalacOptions ++= scala3Opts,
)
./src/main/scala/Path.scala
:
import UndoRedo.*
abstract trait Path[
B <: Path[B, U, R],
U <: Undo[B, U, R],
R <: Redo[B, U, R]
]:
val parent: Option[B]
val undo: Option[U]
val redo: Option[R]
protected def apply(): B // fresh
./src/main/scala/UndoRedo.scala
:
import UndoRedo.*
abstract trait UndoRedo[
B <: Path[B, U, R],
U <: Undo[B, U, R] & UndoRedo[B, U, R, U],
R <: Redo[B, U, R] & UndoRedo[B, U, R, R],
UR <: UndoRedo[B, U, R, UR]
]:
val next: Option[UR]
val path: B
def apply(real: B): UR // clone
object UndoRedo:
abstract trait Undo[
B <: Path[B, U, R],
U <: Undo[B, U, R],
R <: Redo[B, U, R]
] extends UndoRedo[B, U, R, U]
abstract trait Redo[
B <: Path[B, U, R],
U <: Undo[B, U, R],
R <: Redo[B, U, R]
] extends UndoRedo[B, U, R, R]:
val undo: U
Output
Just change the comment only in UndoRedo.scala
from // clone
to /* clone */
and issue compile
in sbt
shell again:
sbt:test> compile
[info] compiling 1 Scala source to /home/user/target/scala-3.7.2-RC1/classes ...
[error] -- [E057] Type Mismatch Error: /home/user/src/main/scala/UndoRedo.scala:22:30
[error] 22 | ] extends UndoRedo[B, U, R, U]
[error] | ^
[error] | Type argument U does not conform to upper bound UndoRedo[B, U, R, U]
[error] |
[error] | longer explanation available when compiling with `-explain`
[error] -- [E057] Type Mismatch Error: /home/user/src/main/scala/UndoRedo.scala:29:27
[error] 29 | ] extends UndoRedo[B, U, R, R]:
[error] | ^
[error] |Type argument R does not conform to upper bound UndoRedo.Redo[B, U, R] & UndoRedo[B, U, R, R]
[error] |
[error] | longer explanation available when compiling with `-explain`
[error] -- [E057] Type Mismatch Error: /home/user/src/main/scala/UndoRedo.scala:29:30
[error] 29 | ] extends UndoRedo[B, U, R, R]:
[error] | ^
[error] | Type argument R does not conform to upper bound UndoRedo[B, U, R, R]
[error] |
[error] | longer explanation available when compiling with `-explain`
[error] three errors found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 0 s, completed 9 jul 2025, 20:36:17
The errors are the same: Type argument R does not conform to upper bound ...
Change the comment back to // code
and it's as nothing has happened.
Expectation
A modification of the file's digest should incrementally recompile ok.
If both *.scala
source file's are modified, then recompilation succeeds.