Skip to content

Bounds check failure involving unions of singleton types #8129

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

Closed
OlivierBlanvillain opened this issue Jan 29, 2020 · 0 comments
Closed

Bounds check failure involving unions of singleton types #8129

OlivierBlanvillain opened this issue Jan 29, 2020 · 0 comments

Comments

@OlivierBlanvillain
Copy link
Contributor

object Test {
  type F[N <: 0 | 1] = N
  def fl[N <: 0 | 1]: F[N] = ???
}
-- [E057] Type Mismatch Error: /test.scala:3:24 
3 |  def fl[N <: 0 | 1]: F[N] = ???
  |                        ^
  |Type argument N does not conform to upper bound (0 : scala.Int) | (1 : scala.Int) 
==> isSubType N <:< (0 : scala.Int) | (1 : scala.Int) ?
  ==> isSubType N <:< scala.Nothing ?
    ==> isSubType (0 : scala.Int) | (1 : scala.Int) <:< scala.Nothing LoApprox?
      ==> isSubType scala.Int <:< scala.Nothing LoApprox?
      <== isSubType scala.Int <:< scala.Nothing LoApprox = false
      ==> isSubType (0 : scala.Int) <:< scala.Nothing LoApprox?
        ==> isSubType scala.Int <:< scala.Nothing LoApprox?
        <== isSubType scala.Int <:< scala.Nothing LoApprox = false
      <== isSubType (0 : scala.Int) <:< scala.Nothing LoApprox = false
    <== isSubType (0 : scala.Int) | (1 : scala.Int) <:< scala.Nothing LoApprox = false
  <== isSubType N <:< scala.Nothing  = false
<== isSubType N <:< (0 : scala.Int) | (1 : scala.Int)  = false

(I tought this was related to #8126, but it's something else)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant