Tricky "too many parameters for type" error

No, the problem is that your BarVec line doesn’t make sense since Bar only has a single type parameter A (though that A is restricted to be an AbstractArray).

I think you are trying to achieve the following

julia> const BarVec = Bar{A} where A <: AbstractArray{T, 1} where T
Foo{A} where A<:AbstractArray{T,1} where T

julia> BarVec{Int64}{Vector{Int64}}([1])
Foo{Array{Int64,1}}([1])

but note that the constructor becomes more annoying to specify (multiple sets of braces). Personally I wouldn’t enforce multi-layered type constraints like this but instead use a constructor to enforce it.

1 Like