Skip to content

Matching BigInt against Int literal pattern leads to warning #23316

Open
@t9dupuy

Description

@t9dupuy

Compiler version

3.7.0

Minimized code

//> using scala 3.7.0

@main def main(): Unit =
  BigInt(1) match
    case 1 => println("matched")
    case _ => println("didn't match")

Output

compile

[warn] -- [E030] Match case Unreachable Warning: D:\scala\run\src\main\scala\Main.scala:7:9 
[warn] 7 |    case 1 => println("matched")
[warn]   |         ^
[warn]   |         Unreachable case

run

matched

Expectation

No warning.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions