summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorDavid Feuer <david.feuer@gmail.com>2017-01-24 15:59:39 -0500
committerDavid Feuer <David.Feuer@gmail.com>2017-01-24 15:59:40 -0500
commit99f818282673c9946a162c1727c4cecada76ddee (patch)
tree4131f01ac127d29243365fbdefe1e4f241c081c7 /compiler
parent9fd87ef8a16fbbce35205ae63d75d239bb575ccc (diff)
downloadhaskell-99f818282673c9946a162c1727c4cecada76ddee.tar.gz
Partially revert D3001
D3001 accidentally changed the meaning of `containsSpan`. Revert that change. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3015
Diffstat (limited to 'compiler')
-rw-r--r--compiler/basicTypes/SrcLoc.hs16
1 files changed, 7 insertions, 9 deletions
diff --git a/compiler/basicTypes/SrcLoc.hs b/compiler/basicTypes/SrcLoc.hs
index af757f5ca7..06f42cc8de 100644
--- a/compiler/basicTypes/SrcLoc.hs
+++ b/compiler/basicTypes/SrcLoc.hs
@@ -344,15 +344,13 @@ isOneLineSpan (UnhelpfulSpan _) = False
-- that it covers at least as much source code. True where spans are equal.
containsSpan :: RealSrcSpan -> RealSrcSpan -> Bool
containsSpan s1 s2
- = srcSpanEndCol s1 >= srcSpanEndCol s2
- && srcSpanStartCol s1 <= srcSpanStartCol s2
- && srcSpanEndLine s1 >= srcSpanEndLine s2
- && srcSpanStartLine s1 <= srcSpanStartLine s2
- && srcSpanFile s1 == srcSpanFile s2
- -- ordered roughly by the likelihood of failing:
- -- * we're more likely to be comparing source spans from the same file
- -- * we're more likely to be comparing source spans on the same line
-
+ = (srcSpanStartLine s1, srcSpanStartCol s1)
+ <= (srcSpanStartLine s2, srcSpanStartCol s2)
+ && (srcSpanEndLine s1, srcSpanEndCol s1)
+ >= (srcSpanEndLine s2, srcSpanEndCol s2)
+ && (srcSpanFile s1 == srcSpanFile s2)
+ -- We check file equality last because it is (presumably?) least
+ -- likely to fail.
{-
%************************************************************************
%* *