Skip to content

Wrong lower type bound is accepted #4369

Closed
@sir-wabbit

Description

@sir-wabbit
trait X[R <: Z, Z >: X[R, R]] {
  // def foo(x: X[R, R]): Z = x
}
class Z extends X[Z, Z]

Somehow this compiles, even though foo doesn't. Note that class Z is not a super type of X[Z, Z], which is required by the second type parameter of trait X.

trait X[R <: Z, Z >: X[R, R] <: X[R, R]] {
  // implicitly[Z =:= X[R, R]] // won't compile
}
class Z extends X[Z, Z]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions