Scala 3 does not perform implicit conversion using <:<
See original GitHub issueCompiler version
3.0.2-RC1-bin-SNAPSHOT
Minimized code
import Tuple.Union
type Channel = "orders" | "trades"
def getChannelList[Channels <: NonEmptyTuple](c: Channels)(using Union[Channels] <:< Channel) =
val channels: List[Channel] = c.toList
channels
Expectation
Compiles fine
Output
fails to compile with error:
[error] 6 | val channels: List[Channel] = c.toList
[error] | ^^^^^^^^
[error] |Found: List[Tuple.Union[(c : Channels)]]
[error] |Required: List[Channel]
[error] |
[error] |where: Channels is a type in method getChannelList with bounds <: NonEmptyTuple
[error] |
[error] |
[error] |Note: a match type could not be fully reduced:
[error] |
[error] | trying to reduce Tuple.Union[(c : Channels)]
[error] | trying to reduce scala.Tuple.Fold[(c : Channels), Nothing, [x, y] =>> x | y]
[error] | failed since selector (c : Channels)
[error] | matches none of the cases
[error] |
[error] | case EmptyTuple => Nothing
[error] | case h *: t => h | scala.Tuple.Fold[t, Nothing, [x, y] =>> x | y]
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (11 by maintainers)
Top Results From Across the Web
Implicit Conversions
An implicit conversion is applied automatically by the compiler in three situations: ... In the first case, the compiler looks for a given...
Read more >Can't convert a function to a trait using an implicit conversion ...
It seems that the function needs to be fully specified to make the implicit conversion happen. Otherwise you get an 'missing parameter type' ......
Read more >Scala 3 Implicit Redesign - Baeldung
Implicit conversion is a way to convert a value from one data type to another without any explicit transformation. ... If we have...
Read more >Why are implicit conversion deprecated in scala?
Martin Odersky, the inventor of Scala, has indicated that implicits (and implicit conversions) are being deprecated in scala 3.1 and will ...
Read more >Givens vs. Implicits in Scala 3 - Rock the JVM Blog
given/using clauses are used for passing “implicit” arguments · implicit conversions are done by creating instances of Conversion · extension ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.)
I dont think it does, actually, I can’t get an implicit evidence calling
getChannelList