Possible bug with tuple values in type arguments

Hi all,

Can anyone explain why the following works:

Val{(:a,:b,:c)}()

but this does not?

Val{(:a,:b,(:c,:d))}()
ERROR: TypeError: in Type, in parameter, expected Type, got a value of type Tuple{Symbol, Symbol, Tuple{Symbol, Symbol}}
Stacktrace:
 [1] top-level scope
   @ REPL[77]:1

At first, I thought maybe the problem was the nested tuple, but this works fine:

Val{(:a,:b,(1,2))}()

So what’s up with this? I don’t really see the logical reason why sometimes tuple values are allowed in type arguments, and sometimes they are not?

ComponentArrays also seems to somehow get away with this, since all of the axis information is stored as named tuples in Axis. Maybe @jonniedie could provide some insight here?

Oh, that’s weird. I don’t have a good explanation for that. ComponentArrays actually stores other AbstractAxis instances inside the Axis type parameters. So it’s more similar to

Val{(:a,:b,Val{(:c,:d)}())}()

(which works)

Yes, that works for me too. The only difference is the nested Val. Still, I’m not seeing the logic behind why one is allowed by the type system but not the other. I think we need a Julia type expert here.