Skip to content

Commit 07c942c

Browse files
Merge pull request #8494 from dotty-staging/fix-7872
Fix #7872: Add regression test
2 parents 613a419 + 0c68cbe commit 07c942c

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

compiler/test/dotc/pos-test-pickling.blacklist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ matchtype.scala
2525
6322.scala
2626
i7087.scala
2727
i7868.scala
28+
i7872.scala
2829

2930
# Opaque type
3031
i5720.scala
@@ -37,4 +38,4 @@ i7580.scala
3738
nullable.scala
3839

3940
# parameter untupling with overloaded functions (see comment in Applications.normArg)
40-
i7757.scala
41+
i7757.scala

tests/pos/i7872.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
}

0 commit comments

Comments
 (0)