Skip to content

Commit 747a473

Browse files
Backport "Add regression test for issue i18493" to LTS (#20664)
Backports #18497 to the LTS branch. PR submitted by the release tooling. [skip ci]
2 parents 0365d9f + c6ade8b commit 747a473

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

tests/neg/18493.check

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- [E030] Match case Unreachable Error: tests/neg/18493.scala:6:9 ------------------------------------------------------
2+
6 | case "abc" => // error
3+
| ^^^^^
4+
| Unreachable case
5+
-- [E030] Match case Unreachable Error: tests/neg/18493.scala:12:9 -----------------------------------------------------
6+
12 | case "abc" => // error
7+
| ^^^^^
8+
| Unreachable case

tests/neg/18493.scala

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//> using options -Werror
2+
object PartialFunctionNoWarning {
3+
// nice warning
4+
"abc" match {
5+
case "abc" =>
6+
case "abc" => // error
7+
}
8+
9+
// no warnings
10+
val pf: PartialFunction[String, Unit] = {
11+
case "abc" =>
12+
case "abc" => // error
13+
}
14+
}

0 commit comments

Comments
 (0)