From 12517bd8ca20f574b65426ada6a28e69963b2bce Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Sun, 29 Oct 2017 20:26:13 +0100 Subject: [PATCH] size -> indices to fix show of OffsetArrays (#24393) --- base/show.jl | 2 +- test/offsetarray.jl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/base/show.jl b/base/show.jl index da6c84e11fa4f..1c476f814d987 100644 --- a/base/show.jl +++ b/base/show.jl @@ -1915,7 +1915,7 @@ function show_nd(io::IO, a::AbstractArray, print_matrix, label_slices) if length(ind) > 10 if ii == ind[4] && all(d->idxs[d]==first(tailinds[d]),1:i-1) for j=i+1:nd - szj = size(a,j+2) + szj = length(indices(a, j+2)) indj = tailinds[j] if szj>10 && first(indj)+2 < idxs[j] <= last(indj)-3 @goto skip diff --git a/test/offsetarray.jl b/test/offsetarray.jl index b9f92895c6ccd..9c1bf2cea51e5 100644 --- a/test/offsetarray.jl +++ b/test/offsetarray.jl @@ -176,6 +176,7 @@ cmp_showf(Base.print_matrix, io, OffsetArray(rand(5,5), (10,-9))) # rows&c cmp_showf(Base.print_matrix, io, OffsetArray(rand(10^3,5), (10,-9))) # columns fit cmp_showf(Base.print_matrix, io, OffsetArray(rand(5,10^3), (10,-9))) # rows fit cmp_showf(Base.print_matrix, io, OffsetArray(rand(10^3,10^3), (10,-9))) # neither fits +cmp_showf(Base.show, io, OffsetArray(rand(1,1,10^3,1), (1,2,3,4))) # issue in #24393 targets1 = ["0-dimensional $OAs_name.OffsetArray{Float64,0,Array{Float64,0}}:\n1.0", "$OAs_name.OffsetArray{Float64,1,Array{Float64,1}} with indices 2:2:\n 1.0", "$OAs_name.OffsetArray{Float64,2,Array{Float64,2}} with indices 2:2×3:3:\n 1.0",