scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

Regression in legality of path dependent types

Open WojciechMazur opened this issue 2 years ago • 2 comments

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

WojciechMazur avatar Sep 15 '22 15:09 WojciechMazur

I can't reproduce this on latest main. (?)

odersky avatar Sep 15 '22 20:09 odersky

I can confirm getting a compilation error with 3.2.2-RC1-bin-20220916-afc6ce4-NIGHTLY

prolativ avatar Sep 19 '22 06:09 prolativ