File tree 2 files changed +25
-1
lines changed
2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ matchtype.scala
25
25
6322.scala
26
26
i7087.scala
27
27
i7868.scala
28
+ i7872.scala
28
29
29
30
# Opaque type
30
31
i5720.scala
@@ -37,4 +38,4 @@ i7580.scala
37
38
nullable.scala
38
39
39
40
# parameter untupling with overloaded functions (see comment in Applications.normArg)
40
- i7757.scala
41
+ i7757.scala
Original file line number Diff line number Diff line change
1
+ object Test {
2
+ def flip : (x : 0 | 1 ) => x.type match { case 0 => 1 case 1 => 0 } = ???
3
+ flip(0 ): 1
4
+ flip(1 ): 0
5
+ flip(if ??? then 0 else 1 )
6
+ val n : 0 | 1 = if ??? then 0 else 1
7
+ flip(n)
8
+ val m : n.type match { case 0 => 1 case 1 => 0 } = flip(n)
9
+ }
10
+
11
+ object Test2 {
12
+ type Flip [N <: 0 | 1 ] <: 0 | 1 = N match { case 0 => 1 case 1 => 0 }
13
+ def flip : (x : 0 | 1 ) => Flip [x.type ] = ???
14
+ flip(0 ): 1
15
+ flip(1 ): 0
16
+ }
17
+
18
+ object Test3 {
19
+ type Flip [N <: 0 | 1 ] <: 0 | 1 = N match { case 0 => 1 case 1 => 0 }
20
+ def flip (x : 0 | 1 ): Flip [x.type ] = ???
21
+ flip(0 ): 1
22
+ flip(1 ): 0
23
+ }
You can’t perform that action at this time.
0 commit comments