1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 01:47:01 +03:00

Revert "Revert "Correct the computation of range intersection.""

This reverts commit 02bcb272e36a62a90c099af22add47c69160e941.
This commit is contained in:
Rob Rix 2016-05-27 14:27:50 -04:00
parent 1cb7946cb0
commit 81fd09ae25

View File

@ -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