Skip to content

Inconsistent comparison of types involving unions of singleton types with Nothing #11003

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
prolativ opened this issue Jan 5, 2021 · 0 comments · Fixed by #11083
Closed

Inconsistent comparison of types involving unions of singleton types with Nothing #11003

prolativ opened this issue Jan 5, 2021 · 0 comments · Fixed by #11083
Assignees
Milestone

Comments

@prolativ
Copy link
Contributor

prolativ commented Jan 5, 2021

Minimized code

object Foo

val intSuper = summon[(Int | Nothing) <:< Int]
val intSub = summon[Int <:< (Int | Nothing)]
val intEq = summon[Int =:= (Int | Nothing)]

val fooSuper = summon[(Foo.type | Nothing) <:< Foo.type]
val fooSub = summon[Foo.type <:< (Foo.type | Nothing)]
val fooEq = summon[Foo.type =:= (Foo.type | Nothing)]

val oneSuper = summon[(1 | Nothing) <:< 1]
val oneSub = summon[1 <:< (1 | Nothing)]
val oneEq = summon[1 =:= (1 | Nothing)]

Output

[error] 9 |val fooEq = summon[Foo.type =:= (Foo.type | Nothing)]
[error]   |                                                     ^
[error]   |                        Cannot prove that Foo.type =:= Foo.type | Nothing.
[error] 11 |val oneSuper = summon[(1 | Nothing) <:< 1]
[error]    |                                          ^
[error]    |                    Cannot prove that (1 : Int) | Nothing <:< (1 : Int).
[error] 13 |val oneEq = summon[1 =:= (1 | Nothing)]
[error]    |                                       ^
[error]    |                    Cannot prove that (1 : Int) =:= (1 : Int) | Nothing.

Expectation

This should compile.

This bug might be the reason of #10897

@prolativ prolativ changed the title Inconsistent comparison of types involving unions with Nothing Inconsistent comparison of types involving unions of singleton types with Nothing Jan 5, 2021
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants