-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Scala 3 does not perform implicit conversion using <:< #12955
Comments
Might be related to #12721 |
@dwijnand I don't think you meant to assign me? |
You were going to look if related PRs would fix this, and I was trying to get you hooked in enough to see if you could look into it further... |
I have no recollection of that, and I don't have any special expertise here, so hopefully someone else would like to look into it. |
I am surprised fixing this #10897 didn't fix this issue. |
LOL, I just found a note I wrote to myself that says "I told Dale I would definitely follow up on this" 😅 But actually, it appears that all I was going to do was verify that it isn't actually fixed yet. And now @Swoorup has already checked that. (And I just double-checked it.) |
Minimized def test[A, B](using A <:< B) =
val b: B = ??? : A |
It works with implicit, but I don't recall that being an intentional difference? def test[A, B](implicit ev: A <:< B) =
val b: B = ??? : A
b |
btw this is also happening when you have |
It's because Maybe we need to special-case |
|
@odersky |
@Swoorup this should fix your example: import Tuple.Union
type Channel = "orders" | "trades"
def getChannelList[Channels <: NonEmptyTuple](c: Channels)(using ev: Union[c.type] <:< Channel) =
given (List[Union[c.type]] <:< List[Channel]) = ev.liftCo
val channels: List[Channel] = c.toList
channels |
I dont think it does, actually, I can't get an implicit evidence calling |
maybe scala> import Tuple.Union
scala> type Channel = "orders" | "trades"
// defined alias type Channel = "orders" | "trades"
scala> summon[Tuple.Union[("orders", "trades")] <:< Channel]
val res0: ("orders" | "trades") =:= ("orders" | "trades") = generalized constraint
scala> def foo[Channels <: NonEmptyTuple](using Tuple.Union[Channels] <:< Channel) = ???
def foo
[Channels <: NonEmptyTuple]
(using x$1: Tuple.Union[Channels] <:< Channel): Nothing
scala> foo[("orders", "trades")]
-- Error: ----------------------------------------------------------------------
1 |foo[("orders", "trades")]
| ^
|Cannot prove that Tuple.Union[(("orders" : String), ("trades" : String))] <:< Channel.
1 error found
|
Compiler version
3.0.2-RC1-bin-SNAPSHOT
Minimized code
Expectation
Compiles fine
Output
fails to compile with error:
The text was updated successfully, but these errors were encountered: