-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Match types are (intersection|union)-order-sensitive #6571
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
Labels
Comments
Weirdly enough, the following does reduce: scala> object Test {
| type M[t] = t match {
| case u | v => u
| }
| def foo: M[Int | String] = ""
| }
// defined object Test but the following does not: scala> object Test {
| type M[t] = t match {
| case u & v => u
| }
| def foo: M[Int & String] = ""
| }
5 | def foo: M[Int & String] = ""
| ^^
| Found: String("")
| Required: Test.M[Int & String] |
|
OlivierBlanvillain
added a commit
to dotty-staging/dotty
that referenced
this issue
Apr 6, 2022
OlivierBlanvillain
added a commit
that referenced
this issue
Apr 7, 2022
Fix #6571: Add regression test
michelou
pushed a commit
to michelou/scala3
that referenced
this issue
Apr 25, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Match types allow telling apart intersection types which differ only in the order of elements. We probably don't want to allow doing that.
A possible fix would be to use
GADTFlexible
mode when reducing match types, which would not put any constraints onu
fromInv[Int] & Inv[String] <: Inv[u]
.The text was updated successfully, but these errors were encountered: