Skip to content

Type mismatch error using case class extractor with multiple type parameters, constraints, and | matcher #23696

@eejbyfeldt

Description

@eejbyfeldt

Compiler version

3.7.2 but works on 3.7.1 and 3.7.0

Minimized code

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

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

Output

-- [E057] Type Mismatch Error: i22879_modified.scala:8:15 ---------
8 |      case A | I() => ???
  |               ^
  |               Type argument T does not conform to upper bound Iterable[T$1]
  |
  | longer explanation available when compiling with `-explain`
1 error found

Expectation

No warnings should be produced. Matching on A and I() it separate case works.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions