Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Curtis Vogt <curtis.vogt@gmail.com>
  • Loading branch information
pabloferz and omus committed Feb 19, 2022
1 parent ee77d7a commit 6452e0b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import Dates: Date, DateTime
export Inclusivity, inclusivity
include("inclusivity.jl")

@deprecate Date(interval::Interval{Date}) convert(Date, interval)
@deprecate DateTime(interval::Interval{DateTime}) convert(DateTime, interval)
@deprecate Date(interval::AnchoredInterval{P, Date} where P) convert(Date, interval)
@deprecate DateTime(interval::AnchoredInterval{P, DateTime} where P) convert(DateTime, interval)
@deprecate Date(interval::Interval{Date}) only(interval)
@deprecate DateTime(interval::Interval{DateTime}) only(interval)
@deprecate Date(interval::AnchoredInterval{P, Date} where P) only(interval)
@deprecate DateTime(interval::AnchoredInterval{P, DateTime} where P) only(interval)


function Endpoint{T,D}(ep::T, included::Bool) where {T,D}
Expand Down
4 changes: 2 additions & 2 deletions src/interval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ end
only(interval::AbstractInterval)
Returns the only element of a closed interval with coinciding endpoints (throws a
DomainError otherwise).
`DomainError` otherwise).
"""
function Base.only(interval::Interval)
function Base.only(interval::AbstractInterval)
if first(interval) == last(interval) && isclosed(interval)
return first(interval)
else
Expand Down
2 changes: 1 addition & 1 deletion test/interval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
@test hash(a) == hash(b)
end

@testset "conversion" begin
@testset "only" begin
@test_throws DomainError only(Interval{Open, Open}(10, 10))
@test_throws DomainError only(Interval{Open, Closed}(10, 10))
@test_throws DomainError only(Interval{Closed, Open}(10, 10))
Expand Down

0 comments on commit 6452e0b

Please sign in to comment.