Proper parametric subtyping of AbstractArray

I am not sure I understood the specs, but I am wondering if you are simply looking for

struct Foo{T,C,W<:AbstractArray{T,C},S<:NTuple{C,Symbol}} <: AbstractVector{T}
    weights::W
    support::S
end

Note

  1. that parametric supertypes need parameters, eg

    struct Bar <: AbstractVector end
    

    will error,

  2. structs cannot have an UnionAll/where clause outside (what would it even mean?), so

    struct Baz{T} where T end
    

    will error.

These two are MWE for your error messages.

You may want to revisit the types chapter of the manual.

2 Likes