Skip to content

No warning about non-exhaustive pattern matching for constructor with type bound enclosing type member #23369

Open
@Alex1005a

Description

@Alex1005a

Compiler version

scala 3.7.1

Minimized code

class Module {
  type BarTy
  sealed trait Adt[A]
  case class Foo() extends Adt[String]
  case class Bar[A <: BarTy](x: BarTy) extends Adt[A]
}

object Basic extends Module {
  type BarTy = String
}

def test(a: Basic.Adt[String]) = {
    a match
        case Basic.Foo() =>
}

val result = test(Basic.Bar(""))
print(result)

Output

Exception in thread "main" scala.MatchError: Bar()

Expectation

Compiler warning: match may not be exhaustive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions