Skip to content

Commit dfd1e19

Browse files
authored
Merge pull request #10 from JuliaMath/teh/depwarn0.6
Fix typealias and inner constructor depwarns on 0.6
2 parents e7777c2 + 6bc3738 commit dfd1e19

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

REQUIRE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
julia 0.5-
1+
julia 0.5
2+
Compat 0.18

src/IntervalSets.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ module IntervalSets
77
using Base: @pure
88
import Base: eltype, convert, show, in, length, isempty, isequal, issubset, ==, hash, union, intersect, minimum, maximum
99

10+
using Compat
11+
1012
export AbstractInterval, ClosedInterval, , .., ±, ordered, width
1113

12-
abstract AbstractInterval{T}
14+
@compat abstract type AbstractInterval{T} end
1315

1416
include("closed.jl")
1517

@@ -27,6 +29,7 @@ ordered(a, b) = ordered(promote(a, b)...)
2729

2830
checked_conversion{T}(::Type{T}, a, b) = _checked_conversion(T, convert(T, a), convert(T, b))
2931
_checked_conversion{T}(::Type{T}, a::T, b::T) = a, b
32+
_checked_conversion(::Type{Any}, a, b) = throw(ArgumentError("$a and $b promoted to type Any"))
3033
_checked_conversion{T}(::Type{T}, a, b) = throw(ArgumentError("$a and $b are not both of type $T"))
3134

3235
end # module

src/closed.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ immutable ClosedInterval{T} <: AbstractInterval{T}
66
left::T
77
right::T
88

9-
ClosedInterval(l::T, r::T) = new(l, r)
9+
(::Type{ClosedInterval{T}}){T}(l::T, r::T) = new{T}(l, r)
1010
end
1111

1212
ClosedInterval{T}(left::T, right::T) = ClosedInterval{T}(left, right)

test/runtests.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,19 @@ using IntervalSets
22
using Base.Test
33

44
@testset "IntervalSets" begin
5-
io = IOBuffer()
65
@test ordered(2, 1) == (1, 2)
76
@test ordered(1, 2) == (1, 2)
87
@test ordered(Float16(1), 2) == (1, 2)
98

109
@testset "Closed Sets" begin
1110
@test_throws ArgumentError :a .. "b"
1211
I = 0..3
13-
print(io, I)
14-
@test takebuf_string(io) == "0..3"
12+
@test string(I) == "0..3"
1513
J = 3..2
1614
K = 5..4
1715
L = 3 ± 2
1816
M = ClosedInterval(2, 5.0)
19-
print(io, M)
20-
@test takebuf_string(io) == "2.0..5.0"
17+
@test string(M) == "2.0..5.0"
2118
N = ClosedInterval(UInt8(255), 300)
2219
O = CartesianIndex(1, 2, 3, 4) ± 2
2320
@test O == (-1..3, 0..4, 1..5, 2..6)

0 commit comments

Comments
 (0)