From c24ed754be9194e19664831006f4312f0d1fda33 Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Sun, 15 Apr 2018 14:01:56 +0100 Subject: [PATCH 1/2] Remove argument restriction on dims2string and inds2string (#26799) --- base/show.jl | 4 ++-- test/show.jl | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/base/show.jl b/base/show.jl index e34a9290fbf7f..fae87241274c7 100644 --- a/base/show.jl +++ b/base/show.jl @@ -1835,11 +1835,11 @@ end ## `summary` for AbstractArrays # sizes such as 0-dimensional, 4-dimensional, 2x3 -dims2string(d::Dims) = isempty(d) ? "0-dimensional" : +dims2string(d) = isempty(d) ? "0-dimensional" : length(d) == 1 ? "$(d[1])-element" : join(map(string,d), '×') -inds2string(inds::Indices) = join(map(string,inds), '×') +inds2string(inds) = join(map(string,inds), '×') # anything array-like gets summarized e.g. 10-element Array{Int64,1} summary(io::IO, a::AbstractArray) = summary(io, a, axes(a)) diff --git a/test/show.jl b/test/show.jl index d849901deade5..b76c963fa1f57 100644 --- a/test/show.jl +++ b/test/show.jl @@ -1189,3 +1189,10 @@ end @test repr("text/plain", context=:compact=>true) == "\"text/plain\"" @test repr(MIME("text/plain"), context=:compact=>true) == "MIME type text/plain" end + +@testset "BigInt summary #26799" begin + @test Base.dims2string(tuple(BigInt(10))) == "10-element" + @test Base.inds2string(tuple(BigInt(10))) == "10" + @test summary(BigInt(1):BigInt(10)) == "10-element UnitRange{BigInt}" + @test summary(Base.OneTo(BigInt(10))) == "10-element Base.OneTo{BigInt}" +end From a0e5163d39a0ebf38328852296f98c4f2cbdd773 Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Mon, 16 Apr 2018 13:08:17 +0100 Subject: [PATCH 2/2] Fix spaces in show.jl, standardize testset name --- base/show.jl | 4 ++-- test/show.jl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/base/show.jl b/base/show.jl index fae87241274c7..d94e4f17825db 100644 --- a/base/show.jl +++ b/base/show.jl @@ -1836,8 +1836,8 @@ end ## `summary` for AbstractArrays # sizes such as 0-dimensional, 4-dimensional, 2x3 dims2string(d) = isempty(d) ? "0-dimensional" : - length(d) == 1 ? "$(d[1])-element" : - join(map(string,d), '×') + length(d) == 1 ? "$(d[1])-element" : + join(map(string,d), '×') inds2string(inds) = join(map(string,inds), '×') diff --git a/test/show.jl b/test/show.jl index b76c963fa1f57..546c1eb94fdb6 100644 --- a/test/show.jl +++ b/test/show.jl @@ -1190,7 +1190,7 @@ end @test repr(MIME("text/plain"), context=:compact=>true) == "MIME type text/plain" end -@testset "BigInt summary #26799" begin +@testset "#26799 BigInt summary" begin @test Base.dims2string(tuple(BigInt(10))) == "10-element" @test Base.inds2string(tuple(BigInt(10))) == "10" @test summary(BigInt(1):BigInt(10)) == "10-element UnitRange{BigInt}"