Skip to content

Tuple.Union doesn't work if all types in a tuple are singletons #10897

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 Dec 23, 2020 · 3 comments · Fixed by #12847
Closed

Tuple.Union doesn't work if all types in a tuple are singletons #10897

prolativ opened this issue Dec 23, 2020 · 3 comments · Fixed by #12847

Comments

@prolativ
Copy link
Contributor

Minimized code

import Tuple.Union

object Foo

val x = summon[Union[(Foo.type, 1)] =:= (Foo.type | 1)] // doesn't compile
val y = summon[Union[(Foo.type, 1, String)] =:= (Foo.type | 1 | String)] // compiles

Output

val x = summon[Union[(Foo.type, 1)] =:= (Foo.type | 1)] // doesn't compile
                                                       ^
Cannot prove that Tuple.Union[(Foo.type, (1 : Int))] =:= Foo.type | (1 : Int).

Expectation

Tuple.Union should work for tuples containing any types

@Swoorup
Copy link

Swoorup commented Dec 26, 2020

Was wondering the other day in gitter what was wrong with your code. 😄

@Swoorup
Copy link

Swoorup commented May 13, 2021

Just wondering if there is a timeline of this being fixed in future releases?

@Swoorup
Copy link

Swoorup commented Jun 26, 2021

This still seems to have issues in other areas, i.e the following doesn't compile

import Tuple.Union

type Channel = "orders" | "trades"

def getChannelList[Channels <: NonEmptyTuple](c: Channels)(using Union[Channels] <:< Channel) = 
  val channels: List[Channel] = c.toList
  channels

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.

2 participants