typelevel/scala

valueOf[<type alias>] error

Closed this issue · 6 comments

TLS is unable to get a singleton value of a singleton type alias.

scala> valueOf[1]
valueOf[1]
res0: 1 = 1

scala> type SOne = 1
type SOne = 1
defined type alias SOne

scala> valueOf[SOne]
valueOf[SOne]
<console>:16: error: No singleton value available for SOne.
       valueOf[SOne]
              ^

scala> val one : 1 = 1
val one : 1 = 1
one: 1 = 1

scala> valueOf[one.type]
valueOf[one.type]
res2: one.type = 1

scala> type SOne1 = one.type
type SOne1 = one.type
defined type alias SOne1

scala> valueOf[SOne1]
valueOf[SOne1]
<console>:17: error: No singleton value available for SOne1.
       valueOf[SOne1]
paulp commented

This is likely the same sort of issue as seen in #114 - in fact you might want to try the larger patch enclosed there. Bugs of the form "hey, the type alias doesn't work" go way back.

This is fixed in the next TLS release as suggested by @paulp in #114.

Fixed in latest push to scala#5310.

paulp commented

Is there some way to see what the change was? Repeatedly force-pushing a single large commit is a pretty unfortunate workflow. I might have thought the PR would at least record the sha of the overwritten commit but I don't see it anywhere.

That's fair comment. I basically fixed and then squashed for the benefit of the ongoing PR against scala/scala.

The fix was your second change here in full.

paulp commented

Ah. Thanks.