Skip to content

Pattern Match Exhaustiveness Check Misses a Case #20128

Closed
@CyrilFMoser

Description

@CyrilFMoser

Compiler version

3.4.1

Minimized code

sealed trait T_A[A]
case class CC_B[A](a: T_A[A]) extends T_A[Byte]
case class CC_E[A](b: T_A[A]) extends T_A[Byte]

val v_a: T_A[Byte] = CC_E(CC_B(null))
val v_b: Int = v_a match {
  case CC_E(CC_E(_)) => 0
  case CC_B(_)       => 1
}

Output

Crashes

Expectation

Should give a warning at compile time that the pattern match is not exhaustive.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions