Skip to content

Regression in legality of path dependent types #16049

Closed
@WojciechMazur

Description

@WojciechMazur

Regression found in Open CB #7361 for scalanlp/breeze
Bisect points to 57f53d0

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions