We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2e377ca commit f1809bdCopy full SHA for f1809bd
tests/patmat/t10100.check
@@ -0,0 +1 @@
1
+12: Pattern Match Exhaustivity: (_, FancyFoo(_))
tests/patmat/t10100.scala
@@ -0,0 +1,27 @@
+sealed trait Foo {
2
+ val index: Int
3
+}
4
+
5
+case class BasicFoo(index: Int) extends Foo
6
7
+class NonExhaustive {
8
+ case class FancyFoo(index: Int) extends Foo
9
10
+ def convert(foos: Vector[Foo]): Vector[Int] = {
11
+ foos.foldLeft(Vector.empty[Int]) {
12
+ case (acc, basic: BasicFoo) => acc :+ basic.index
13
+ case (acc, fancy: FancyFoo) => acc :+ fancy.index
14
+ }
15
16
17
18
+@main
19
+def Test = {
20
+ val a = new NonExhaustive
21
+ val b = new NonExhaustive
22
23
+ val fa: Foo = a.FancyFoo(3)
24
+ val fb: Foo = b.FancyFoo(4)
25
26
+ a.convert(Vector(fa, fb))
27
0 commit comments