Skip to content

Commit 24c50cc

Browse files
committed
fix stencils
Also improves `summary(::ArrayOp)` for more helpful `BoundsError`s
1 parent 45f4aab commit 24c50cc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/arrays.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ function Base.show(io::IO, aop::ArrayOp)
8181
end
8282
end
8383

84+
Base.summary(io::IO, aop::ArrayOp) = Base.array_summary(io, aop, shape(aop))
85+
function Base.showarg(io::IO, aop::ArrayOp, toplevel)
86+
show(io, aop)
87+
toplevel && print(io, "::", typeof(aop))
88+
return nothing
89+
end
90+
8491
symtype(a::ArrayOp{T}) where {T} = T
8592
istree(a::ArrayOp) = true
8693
function operation(a::ArrayOp)
@@ -208,7 +215,7 @@ function make_shape(output_idx, expr, ranges=Dict())
208215
end
209216
mi = matches[i]
210217
@assert !isempty(mi)
211-
return get_extents(mi)
218+
return Base.OneTo(length(get_extents(mi)))
212219
elseif i isa Integer
213220
return Base.OneTo(1)
214221
end

test/arrays.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,4 +408,4 @@ end
408408

409409
@test_throws BoundsError k[-1]
410410
@test_throws BoundsError k[4]
411-
end
411+
end

0 commit comments

Comments
 (0)