Skip to content

Commit

Permalink
fix stencils
Browse files Browse the repository at this point in the history
Also improves `summary(::ArrayOp)` for more helpful `BoundsError`s
  • Loading branch information
simeonschaub committed Oct 8, 2023
1 parent e9e858c commit a1034b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/arrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ function Base.show(io::IO, aop::ArrayOp)
end
end

Base.summary(io::IO, aop::ArrayOp) = Base.array_summary(io, aop, shape(aop))
function Base.showarg(io::IO, aop::ArrayOp, toplevel)
show(io, aop)
toplevel && print(io, "::", typeof(aop))
return nothing
end

symtype(a::ArrayOp{T}) where {T} = T
istree(a::ArrayOp) = true
function operation(a::ArrayOp)
Expand Down Expand Up @@ -208,7 +215,7 @@ function make_shape(output_idx, expr, ranges=Dict())
end
mi = matches[i]
@assert !isempty(mi)
return get_extents(mi)
return Base.OneTo(length(get_extents(mi)))
elseif i isa Integer
return Base.OneTo(1)
end
Expand Down
2 changes: 1 addition & 1 deletion test/arrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -408,4 +408,4 @@ end

@test_throws BoundsError k[-1]
@test_throws BoundsError k[4]
end
end

0 comments on commit a1034b4

Please sign in to comment.