Skip to content

PartialFunction definitions should not generate exhaustiveness warning #3206

Closed
@smarter

Description

@smarter

This started happening recently, you can see lots of spurious warnings by doing ;dotty-bootstrapped/clean;dotty-bootstrapped/compiler, here's a minimal example:

object Test {
  val foo: PartialFunction[Option[Int], Int] = {
    case Some(x) => x
  }
}
-- [E028] Pattern Match Exhaustivity Warning: try/pf2.scala:3:4 ----------------
3 |    case Some(x) => x
  |    ^
  |    match may not be exhaustive.
  |    
  |    It would fail on: None

Would be nice to get a fix for this before releasing 0.4.0-RC1 (/cc @allanrenucci)

PS: This is why we should try to get to zero warnings and enable -Xfatal-warnings as soon as possible :).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions