Skip to content

Type mismatch error using case class extractor with multiple type parameters and constraints #22879

Closed
@eejbyfeldt

Description

@eejbyfeldt

Compiler version

3.6.4 (Works like expected in 2.13.16)

Minimized code

object Test {
  sealed trait E[T]
  final case class I[T, I <: Iterable[T]]() extends E[I]

  def test[T](a: E[T]): Unit = {
    a match {
      case I() => ???
    }
  }
}

Output

-- [E057] Type Mismatch Error: match_bound.scala:7:11 ----------------------------------------
7 |      case I() => ???
  |           ^
  |           Type argument T does not conform to upper bound Iterable[T$1]
  |
  |           where:    T is a type in method test with bounds <: Iterable[T²]
  |
  | longer explanation available when compiling with `-explain`
1 error found

Expectation

Compiles without errors or warnings.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions