scala3
scala3 copied to clipboard
Regression in legality of path dependent types
Regression found in Open CB #7361 for scalanlp/breeze Bisect points to https://github.com/lampepfl/dotty/commit/57f53d0725c859bffcadc8919524b9b0d43805ba
Compiler version
3.2.2-RC1-nightly Works in 3.2.1-RC1
Minimized code
trait BatchDiffFunction[T]
abstract class FirstOrderMinimizer[T, DF <: BatchDiffFunction[T]]:
type State = FirstOrderMinimizer.State[T]
object FirstOrderMinimizer:
case class State[+T](x: T)
class OptParams:
def iterations[T](init: T): Iterator[FirstOrderMinimizer[T, BatchDiffFunction[T]]#State] = ???
Output
Compiling project (Scala 3.2.2-RC1-bin-20220913-a3c0bef-NIGHTLY, JVM)
[error] ./test.scala:10:42:
[error] FirstOrderMinimizer[T, BatchDiffFunction[T]] is not a legal path
[error] since it has a member DF with possibly conflicting bounds BatchDiffFunction[T] <: ... <: BatchDiffFunction[T] & BatchDiffFunction[T]
[error] def iterations[T](init: T): Iterator[FirstOrderMinimizer[T, BatchDiffFunction[T]]#State] = ???
[error]
Expectation
Should compile
I can't reproduce this on latest main. (?)
I can confirm getting a compilation error with 3.2.2-RC1-bin-20220916-afc6ce4-NIGHTLY