Skip to content

("A" | "B") <:< Singleton ? #15052

Closed
Closed
@armanbilge

Description

@armanbilge

Compiler version

3.1.2

Minimized code

Welcome to Scala 3.1.2 (11.0.13, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                                                                                 
scala> summon[("A" | "B") <:< Singleton]
val res0: ("A" | "B") =:= ("A" | "B") = generalized constraint
                                                                                                                                                                 
scala> summon[ValueOf["A" | "B"]]
-- Error: -------------------------------------------------------------------------------------------------------------------------------------------------------
1 |summon[ValueOf["A" | "B"]]
  |                          ^
  |                          No singleton value available for ("A" : String) | ("B" : String).
1 error found
                                                                                                                                                                 
scala> 

Expectation

Seems strange that there is an instance of ("A" | "B") <:< Singleton. I was mighty curious what ValueOf might return!

Metadata

Metadata

Assignees

No one assigned

    Labels

    itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions