From b93763a4b4c2ea0394b6b18036b16d91a4971663 Mon Sep 17 00:00:00 2001 From: Jan Chyb Date: Fri, 1 Sep 2023 12:53:39 +0200 Subject: [PATCH] Add regression test for issue 18493 --- tests/neg/18493.check | 8 ++++++++ tests/neg/18493.scala | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 tests/neg/18493.check create mode 100644 tests/neg/18493.scala 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