Skip to content

forward port knowledge of private and sealed traits in exhaustivity warnings #14579

Closed
@bishabosha

Description

@bishabosha

port fixes from scala 2 that closed scala/scala#9211

Compiler version

3.1.1

Minimized code

trait A {
  sealed abstract class X
  private class X1 extends X with X2 { }
  private trait X2 extends X
  sealed trait X3 extends X

  def f(x: X) = x match {
    case _: X1 => 0
  }
}

Output

-- [E029] Pattern Match Exhaustivity Warning: ----------------------------------
7 |  def f(x: X) = x match {
  |                ^
  |                match may not be exhaustive.
  |
  |                It would fail on pattern case: _: X2, _: X3

Expectation

No warning, like scala 2

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions