Skip to content

Commit

Permalink
Throw error on arrays of arrays. Part of #116
Browse files Browse the repository at this point in the history
  • Loading branch information
jonniedie committed Jan 20, 2022
1 parent cb798fc commit 94c0e74
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 126 deletions.
5 changes: 4 additions & 1 deletion src/componentarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function make_idx(data, x::AbstractArray, last_val)
out = last_index(last_val) .+ (1:length(x))
return (data, ViewAxis(out, ShapedAxis(size(x))))
end
function make_idx(data, x::A, last_val) where A<:AbstractArray{<:Union{NamedTuple, ComponentArray}}
function make_idx(data, x::A, last_val) where {A<:AbstractArray{<:Union{NamedTuple, ComponentArray}}}
len = recursive_length(x)
if eltype(x) |> isconcretetype
out = ()
Expand All @@ -196,6 +196,9 @@ function make_idx(data, x::A, last_val) where A<:AbstractArray{<:Union{NamedTupl
error("Only homogeneous arrays of inner ComponentArrays are allowed.")
end
end
function make_idx(data, x::A, last_val) where {A<:AbstractArray{<:AbstractArray}}
error("ComponentArrays cannot currently contain arrays of arrays as elements. This one contains: \n $x\n")
end


#TODO: Make all internal function names start with underscores
Expand Down
Loading

0 comments on commit 94c0e74

Please sign in to comment.