Skip to content

Commit 2662cdc

Browse files
committed
Add extra test cases for #7807
Thanks to Lionel.
1 parent 6e60814 commit 2662cdc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/pos/i7807.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
object Test with
22

33
def flip: (x: 0 | 1) => x.type match { case 0 => 1 case 1 => 0 } = ???
4+
5+
flip(0): 1
6+
flip(1): 0
7+
8+
flip(if ??? then 0 else 1)
9+
val n: 0 | 1 = if ??? then 0 else 1
10+
flip(n)
11+
12+
val m: n.type match { case 0 => 1 case 1 => 0 } = flip(n)
13+
14+
// The following do not work, see discussion in https://github.com/lampepfl/dotty/pull/7835/files/6e60814e69be5c8d60265d4ce4bc1758863c23d8#r361741296:
15+
// flip(m)
16+
// flip(flip(n))

0 commit comments

Comments
 (0)