Skip to content

Commit

Permalink
define in(v, ::Domain)
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub committed Nov 30, 2022
1 parent 67b478b commit e979412
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/IntervalSets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ closedendpoints(d::TypedEndpointsInterval{:closed,:open}) = (true,false)
closedendpoints(d::TypedEndpointsInterval{:open,:closed}) = (false,true)
closedendpoints(d::TypedEndpointsInterval{:open,:open}) = (false,false)

# We dispatch to _in to avoid ambiguities if packages define in(v::CustomType, I::AbstractInterval)
in(v, I::AbstractInterval) = _in(v, I)
# We dispatch to _in to avoid ambiguities if packages define in(v::CustomType, I::Domain)
in(v, I::Domain) = _in(v, I)
_in(v, I) = throw(MethodError(in, (v, I)))
_in(v, I::TypedEndpointsInterval{:closed,:closed}) = leftendpoint(I) v rightendpoint(I)
_in(v, I::TypedEndpointsInterval{:open,:open}) = leftendpoint(I) < v < rightendpoint(I)
Expand Down

0 comments on commit e979412

Please sign in to comment.