mirror of
https://github.com/github/semantic.git
synced 2024-12-01 00:33:59 +03:00
Correct the computation of range intersection.
This commit is contained in:
parent
ccd45ccecb
commit
835f38bdf8
@ -50,8 +50,7 @@ maybeLastIndex (Range _ end) = Just $ end - 1
|
||||
|
||||
-- | Test two ranges for intersection.
|
||||
intersectsRange :: Range -> Range -> Bool
|
||||
intersectsRange range1 range2 = isWellFormedAndNonEmpty $ intersectionRange range1 range2
|
||||
where isWellFormedAndNonEmpty range = start range < end range
|
||||
intersectsRange range1 range2 = (start range1 > start range2 && start range1 < end range2) || (start range2 > start range1 && start range2 < end range1)
|
||||
|
||||
-- Return the (possibly empty, possibly ill-formed) intersection of two ranges.
|
||||
intersectionRange :: Range -> Range -> Range
|
||||
|
Loading…
Reference in New Issue
Block a user