Skip to content

Wrong warning on matching union types #16899

Closed
@scf37

Description

@scf37

Compiler version

3.2.2

Minimized code

sealed trait Unset

def foo(v: Unset|Option[Int]): Unit = v match
  case v: Unset => ()
  case v: Option[Int] => ()

Output

the type test for Option[Int] cannot be checked at runtime

Expectation

No warning. Unset is sealed trait and therefore this match should be exhaustive. For example, v: String|Option[Int] compiles without warning.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions