Skip to content

Commit 80e04fd

Browse files
committed
Allow abstract parameters in Intervals again
When combined with SIUnits, whose inference is poor, Intervals break. I think disallowing this from the constructor is sufficient in most cases.
1 parent b739cc7 commit 80e04fd

File tree

2 files changed

+0
-2
lines changed

2 files changed

+0
-2
lines changed

src/intervals.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ immutable Interval{T}
3636
lo::T
3737
hi::T
3838
function Interval(lo, hi)
39-
isleaftype(T) || throw(ArgumentError("cannot construct Interval with an abstract type parameter"))
4039
lo <= hi ? new(lo, hi) : throw(ArgumentError("lo must be less than or equal to hi"))
4140
end
4241
end

test/intervals.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
v = [1 .. 2, 3.0 .. 4.0]
1010
@test v[1] === 1.0 .. 2.0
1111
@test v[2] === 3.0 .. 4.0
12-
@test_throws ArgumentError [1 .. 2, Dates.today() .. Dates.today()]
1312

1413
# Test simple arithmetic, with promotion behaviors
1514
@test (1.0 .. 2.0) + 1 === (2.0 .. 3.0)

0 commit comments

Comments
 (0)