Skip to content

Scala 3 does not perform implicit conversion using <:< #12955

@Swoorup

Description

@Swoorup

Compiler 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]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions