Skip to content

Scala 2 regression: F-bounds + wildcard #13133

Closed
@japgolly

Description

@japgolly

Compiler version

  • 3.0.0
  • 3.0.1
  • 3.0.2-RC1

Minimized code

object Blah {
  trait DomZipper[F[_], X, A, Self[G[_], B] <: DomZipper[G, X, B, Self]]
  def apply[Fast[f[_], a] <: DomZipper[f, _, a, Fast]] = () // error
}

object Blah1 {
  trait DomZipper[X, A, Self[B] <: DomZipper[X, B, Self]]
  def apply[Fast[a] <: DomZipper[_, a, Fast]] = () // error
}

object Blah2 {
  trait DomZipper[F[_], X, Self[G[_]] <: DomZipper[G, X, Self]]
  def apply[Fast[f[_]] <: DomZipper[f, _, Fast]] = () // error
  
  def apply1[Fast[f[_]] <: DomZipper[f, _, Fast]] = () // error
}

object Blah3 {
  trait DomZipper[F[_], Self[G[_]] <: DomZipper[G, Self]]
  def apply[Fast[f[_]] <: DomZipper[f, Fast]] = () // ok
}

object Blah4 {
  trait DomZipper[Self <: DomZipper[Self]]
  def apply[Fast <: DomZipper[Fast]] = () // ok
}

object Blah5 {
  trait DomZipper[F[_], A, Self[G[_], B] <: DomZipper[G, B, Self]]
  def apply[Fast[f[_], a] <: DomZipper[f, a, Fast]] = () // ok
}

object Blah6 {
  trait DomZipper[F[_], X, A, Self[G[_], B] <: DomZipper[G, X, B, Self]]
  def apply[Fast[f[_], a] <: DomZipper[f, X, a, Fast], X] = () // ok
}

Output

[error] -- [E057] Type Mismatch Error: a.scala:3:48 
[error] 3 |  def apply[Fast[f[_], a] <: DomZipper[f, _, a, Fast]] = () // error
[error]   |                                                ^
[error]   |Type argument Fast does not conform to upper bound [G[_$2], B] =>> Blah.DomZipper[G, Blah.DomZipper[f, ?, a, Fast]#X, B, Fast]
[error] -- [E057] Type Mismatch Error: a.scala:8:39 
[error] 8 |  def apply[Fast[a] <: DomZipper[_, a, Fast]] = () // error
[error]   |                                       ^
[error]   |Type argument Fast does not conform to upper bound [B] =>> Blah1.DomZipper[Blah1.DomZipper[?, a, Fast]#X, B, Fast]
[error] -- [E057] Type Mismatch Error: a.scala:13:42 
[error] 13 |  def apply[Fast[f[_]] <: DomZipper[f, _, Fast]] = () // error
[error]    |                                          ^
[error]    |Type argument Fast does not conform to upper bound [G[_$5]] =>> Blah2.DomZipper[G, Blah2.DomZipper[f, ?, Fast]#X, Fast]
[error] -- [E057] Type Mismatch Error: a.scala:15:43 
[error] 15 |  def apply1[Fast[f[_]] <: DomZipper[f, _, Fast]] = () // error
[error]    |                                           ^
[error]    |Type argument Fast does not conform to upper bound [G[_$5]] =>> Blah2.DomZipper[G, Blah2.DomZipper[f, ?, Fast]#X, Fast]
[error] four errors found

Expectation

Compiles with Scala 2.12 and 2.13.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions