diff --git a/tests/neg/18493.check b/tests/neg/18493.check new file mode 100644 index 000000000000..79a2872e71e8 --- /dev/null +++ b/tests/neg/18493.check @@ -0,0 +1,8 @@ +-- [E030] Match case Unreachable Error: tests/neg/18493.scala:6:9 ------------------------------------------------------ +6 | case "abc" => // error + | ^^^^^ + | Unreachable case +-- [E030] Match case Unreachable Error: tests/neg/18493.scala:12:9 ----------------------------------------------------- +12 | case "abc" => // error + | ^^^^^ + | Unreachable case diff --git a/tests/neg/18493.scala b/tests/neg/18493.scala new file mode 100644 index 000000000000..8dfb3bf923cc --- /dev/null +++ b/tests/neg/18493.scala @@ -0,0 +1,14 @@ +//> using options -Werror +object PartialFunctionNoWarning { + // nice warning + "abc" match { + case "abc" => + case "abc" => // error + } + + // no warnings + val pf: PartialFunction[String, Unit] = { + case "abc" => + case "abc" => // error + } +} \ No newline at end of file