diff --git a/compiler/test/dotc/pos-test-pickling.blacklist b/compiler/test/dotc/pos-test-pickling.blacklist index 7bfe50ed231b..950d1ce60d0f 100644 --- a/compiler/test/dotc/pos-test-pickling.blacklist +++ b/compiler/test/dotc/pos-test-pickling.blacklist @@ -25,6 +25,7 @@ matchtype.scala 6322.scala i7087.scala i7868.scala +i7872.scala # Opaque type i5720.scala @@ -37,4 +38,4 @@ i7580.scala nullable.scala # parameter untupling with overloaded functions (see comment in Applications.normArg) -i7757.scala \ No newline at end of file +i7757.scala diff --git a/tests/pos/i7872.scala b/tests/pos/i7872.scala new file mode 100644 index 000000000000..0a9fdcce59ba --- /dev/null +++ b/tests/pos/i7872.scala @@ -0,0 +1,23 @@ +object Test { + def flip: (x: 0 | 1) => x.type match { case 0 => 1 case 1 => 0 } = ??? + flip(0): 1 + flip(1): 0 + flip(if ??? then 0 else 1) + val n: 0 | 1 = if ??? then 0 else 1 + flip(n) + val m: n.type match { case 0 => 1 case 1 => 0 } = flip(n) +} + +object Test2 { + type Flip[N <: 0 | 1] <: 0 | 1 = N match { case 0 => 1 case 1 => 0 } + def flip: (x: 0 | 1) => Flip[x.type] = ??? + flip(0): 1 + flip(1): 0 +} + +object Test3 { + type Flip[N <: 0 | 1] <: 0 | 1 = N match { case 0 => 1 case 1 => 0 } + def flip(x: 0 | 1): Flip[x.type] = ??? + flip(0): 1 + flip(1): 0 +}