Skip to content

Pattern Matching : Wrong & Inconsistent exhaustivity warning #17184

@ftucky

Description

@ftucky

Compiler version

3.2.2, 3.3.0-RC3, 3.3.1-RC1-bin-20230328-5c2efc5-NIGHTLY

Minimized code

class Foo
trait Bar:
  val foo : Int
  val f : Option[foo.type] = Some(foo)

  def g : Boolean = 
    f match 
      case None => false
      case Some(_) => true

Output

Warning : 
match may not be exhaustive.

It would fail on pattern case: Some(_)

Expectation

No warning : case Some(_) is recited.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions