Skip to content

Commit 3cdd368

Browse files
committed
Fix #8711: add test
1 parent 3dc73fc commit 3cdd368

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- Error: tests/neg-custom-args/fatal-warnings/i8711.scala:7:9 ---------------------------------------------------------
2+
7 | case x: B => x // error: this case is unreachable since class A is not a subclass of class B
3+
| ^
4+
| this case is unreachable since type A and class B are unrelated
5+
-- Error: tests/neg-custom-args/fatal-warnings/i8711.scala:12:9 --------------------------------------------------------
6+
12 | case x: C => x // error
7+
| ^
8+
| this case is unreachable since type A | B and class C are unrelated
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class A
2+
class B
3+
class C
4+
5+
object Test {
6+
def foo(x: A) = x match {
7+
case x: B => x // error: this case is unreachable since class A is not a subclass of class B
8+
case _ =>
9+
}
10+
11+
def bar(x: A | B) = x match {
12+
case x: C => x // error
13+
case _ =>
14+
}
15+
}

0 commit comments

Comments
 (0)