You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Welcome to Scala3.1.2 (11.0.13, JavaOpenJDK64-BitServerVM).
Type in expressions for evaluation. Ortry:help.
scala> summon[("A"|"B") <:<Singleton]
valres0: ("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!
The text was updated successfully, but these errors were encountered:
Seems strange that there is an instance of ("A" | "B") <:< Singleton
It's inevitable because "A" <: Singleton and "B" <: Singleton, this is a known design flaw of Singleton (which predates union types) and eventually we'll have to replace it with some other mechanism, see #4944.
Compiler version
3.1.2
Minimized code
Expectation
Seems strange that there is an instance of
("A" | "B") <:< Singleton
. I was mighty curious whatValueOf
might return!The text was updated successfully, but these errors were encountered: