While reading the api page for scala.compiletime, I was surprised to find
Which seems to exist as a consequence of tuples of constant types not being themselves constant types. ( for example
constValue[(1,2)] fails with
not a constant type )
As a consequence, since
constValue on the tuple’s element, things like
constValueTuple[( (1,2), (3,4) )] fail.
And more broadly, given a type that is either a constant type or a “constant tuple”, there is no simple way to
There is also no equivalent to
constValueOpt for tuples.
Hence my questions:
- Why are tuples of constant types not also constant types ?
constValuecheat, and work anyways on cases where
constValueOptcheat, and return
Someon cases where
constValueTupleuse a special “union” of
constValueTuplefor the elements instead ?