Skip to content

Commit

Permalink
Define in(v, ::TypedEndpointsInterval)
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub committed Nov 30, 2022
1 parent e979412 commit ddf5679
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/IntervalSets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +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::Domain)
in(v, I::Domain) = _in(v, I)
_in(v, I) = throw(MethodError(in, (v, I)))
# We dispatch to _in to avoid ambiguities if packages define in(v::CustomType, I::TypedEndpointsInterval)
in(v, I::TypedEndpointsInterval) = _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)
_in(v, I::TypedEndpointsInterval{:closed,:open}) = leftendpoint(I) v < rightendpoint(I)
Expand Down

0 comments on commit ddf5679

Please sign in to comment.