Skip to content

Incorrect union type exhaustivity warning #12279

Closed
@Swoorup

Description

@Swoorup

Compiler version

3.0.0-RC3

Minimized code

import scala.reflect.Typeable

def unionTypeTest[T: Typeable](m: Int|T) = 
  m match
    case x: Int => println("Got Int")
    case t: T => println("Got T")

@main def run = 
  unionTypeTest(())

Output

match may not be exhaustive.

It would fail on pattern case: _: T

Expectation

No warnings since the union type match pattern is exhaustive.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions