Skip to content

Fix #7872: Add regression test #8494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiler/test/dotc/pos-test-pickling.blacklist
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ matchtype.scala
6322.scala
i7087.scala
i7868.scala
i7872.scala

# Opaque type
i5720.scala
Expand All @@ -37,4 +38,4 @@ i7580.scala
nullable.scala

# parameter untupling with overloaded functions (see comment in Applications.normArg)
i7757.scala
i7757.scala
23 changes: 23 additions & 0 deletions tests/pos/i7872.scala
Original file line number Diff line number Diff line change
@@ -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
}