[commit: ghc] master: Partially revert D3001 (99f8182)

git at git.haskell.org git at git.haskell.org
Tue Jan 24 21:01:13 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/99f818282673c9946a162c1727c4cecada76ddee/ghc

>---------------------------------------------------------------

commit 99f818282673c9946a162c1727c4cecada76ddee
Author: David Feuer <david.feuer at gmail.com>
Date:   Tue Jan 24 15:59:39 2017 -0500

    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


>---------------------------------------------------------------

99f818282673c9946a162c1727c4cecada76ddee
 compiler/basicTypes/SrcLoc.hs | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/compiler/basicTypes/SrcLoc.hs b/compiler/basicTypes/SrcLoc.hs
index af757f5..06f42cc 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.
 {-
 %************************************************************************
 %*                                                                      *



More information about the ghc-commits mailing list