Subtyping StaticArray
here is making this more confused because it’s adding a different codepath on the abstract type. The crux is that Julia doesn’t automatically create a constructor that fills in some of the parameters:
julia> struct C{N,T}
data::NTuple{N,T}
end
julia> C((1,2,3))
C{3, Int64}((1, 2, 3))
julia> C{3}((1,2,3))
ERROR: MethodError: no method matching (C{3})(::Tuple{Int64, Int64, Int64})
Stacktrace:
[1] top-level scope
@ REPL[2]:1
julia> C{3,Int}((1,2,3))
C{3, Int64}((1, 2, 3))
You can define this constructor yourself:
julia> (::Type{C{N}})(d::NTuple{N,T}) where {N,T} = C{N,T}(d)
julia> C{3}((1,2,3))
C{3, Int64}((1, 2, 3))