From c31893674f1217d1919ae3440de18987a9557f2d Mon Sep 17 00:00:00 2001 From: Yuto Horikawa Date: Sat, 29 Jul 2023 23:30:06 +0900 Subject: [PATCH] Revert spacing in `Base.show` (#148) * revert spacings in Base.show * bump version to v0.7.6 --- Project.toml | 2 +- src/interval.jl | 8 ++++---- test/runtests.jl | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Project.toml b/Project.toml index 2b85651..1494e3d 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "IntervalSets" uuid = "8197267c-284f-5f27-9208-e0e47529a953" -version = "0.7.5" +version = "0.7.6" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/src/interval.jl b/src/interval.jl index 569d417..a693382 100644 --- a/src/interval.jl +++ b/src/interval.jl @@ -94,10 +94,10 @@ Construct a ClosedInterval `iv` spanning the region from ±(x, y) = ClosedInterval(x - y, x + y) ±(x::CartesianIndex, y::CartesianIndex) = ClosedInterval(x-y, x+y) -show(io::IO, I::ClosedInterval) = print(io, leftendpoint(I), " .. ", rightendpoint(I)) -show(io::IO, I::OpenInterval) = print(io, leftendpoint(I), " .. ", rightendpoint(I), " (open)") -show(io::IO, I::Interval{:open,:closed}) = print(io, leftendpoint(I), " .. ", rightendpoint(I), " (open-closed)") -show(io::IO, I::Interval{:closed,:open}) = print(io, leftendpoint(I), " .. ", rightendpoint(I), " (closed-open)") +show(io::IO, I::ClosedInterval) = print(io, leftendpoint(I), "..", rightendpoint(I)) +show(io::IO, I::OpenInterval) = print(io, leftendpoint(I), "..", rightendpoint(I), " (open)") +show(io::IO, I::Interval{:open,:closed}) = print(io, leftendpoint(I), "..", rightendpoint(I), " (open-closed)") +show(io::IO, I::Interval{:closed,:open}) = print(io, leftendpoint(I), "..", rightendpoint(I), " (closed-open)") # The following are not typestable for mixed endpoint types _left_intersect_type(::Type{Val{:open}}, ::Type{Val{L2}}, a1, a2) where L2 = a1 < a2 ? (a2,L2) : (a1,:open) diff --git a/test/runtests.jl b/test/runtests.jl index e36a964..c33378a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -36,7 +36,7 @@ struct IncompleteInterval <: AbstractInterval{Int} end I = 0..3 @test I === ClosedInterval(0,3) === ClosedInterval{Int}(0,3) === Interval(0,3) - @test string(I) == "0 .. 3" + @test string(I) == "0..3" @test @inferred(UnitRange(I)) === 0:3 @test @inferred(range(I)) === 0:3 @test @inferred(UnitRange{Int16}(I)) === Int16(0):Int16(3) @@ -47,7 +47,7 @@ struct IncompleteInterval <: AbstractInterval{Int} end K = 5..4 L = 3 ± 2 M = @inferred(ClosedInterval(2, 5.0)) - @test string(M) == "2.0 .. 5.0" + @test string(M) == "2.0..5.0" N = @inferred(ClosedInterval(UInt8(255), 300)) x, y = CartesianIndex(1, 2, 3, 4), CartesianIndex(1, 2, 3, 4)