File tree Expand file tree Collapse file tree 6 files changed +60
-0
lines changed Expand file tree Collapse file tree 6 files changed +60
-0
lines changed File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ 21: Pattern Match Exhaustivity: K3, K2
Original file line number Diff line number Diff line change
1
+ object App {
2
+ def main (args : Array [String ]): Unit = {
3
+ trait FooT {
4
+ type T
5
+ def subst [F [_]](fa : F [T ]): F [Int ]
6
+ }
7
+ val Foo : FooT = new FooT {
8
+ type T = Int
9
+
10
+ def subst [F [_]](fa : F [T ]): F [Int ] = fa
11
+ }
12
+ type Foo = Foo .T
13
+ type Bar = Foo
14
+
15
+ sealed abstract class K [+ A ]
16
+ final case object K1 extends K [Int ]
17
+ final case object K2 extends K [Foo ]
18
+ final case object K3 extends K [Bar ]
19
+
20
+ val foo : K [Int ] = Foo .subst[K ](K2 )
21
+ def get (k : K [Int ]): Unit = k match {
22
+ case K1 => ()
23
+ // case K2 => ()
24
+ // case K3 => ()
25
+ }
26
+
27
+ get(foo)
28
+ }
29
+ }
Original file line number Diff line number Diff line change
1
+ 21: Pattern Match Exhaustivity: K3, K2
Original file line number Diff line number Diff line change
1
+ object App {
2
+ def main (args : Array [String ]): Unit = {
3
+ trait FooT {
4
+ type T
5
+ def subst [F [_]](fa : F [T ]): F [Int ]
6
+ }
7
+ val Foo : FooT = new FooT {
8
+ type T = Int
9
+
10
+ def subst [F [_]](fa : F [T ]): F [Int ] = fa
11
+ }
12
+ type Foo = Foo .T
13
+ type Bar = Foo
14
+
15
+ sealed abstract class K [- A ]
16
+ final case object K1 extends K [Int ]
17
+ final case object K2 extends K [Foo ]
18
+ final case object K3 extends K [Bar ]
19
+
20
+ val foo : K [Int ] = Foo .subst[K ](K2 )
21
+ def get (k : K [Int ]): Unit = k match {
22
+ case K1 => ()
23
+ // case K2 => ()
24
+ // case K3 => ()
25
+ }
26
+
27
+ get(foo)
28
+ }
29
+ }
You can’t perform that action at this time.
0 commit comments