Skip to content

GADT with subtype cause non exhaustive match #17118

Open
@peter-jerry-ye

Description

@peter-jerry-ye

Compiler version

3.2.2

Minimized code

scastie

enum T[U] {
  case G[A <: Int](i: A) extends T[A]

  // match may not be exhaustive.
  //
  // It would fail on pattern case: T.G(_)
  def f: Int = this match
    case G(i) => ???
}

Output

Warning on match being not exhaustive

Expectation

It should compile

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