[commit: haddock] master: Fix span matching to allow parenthesized operators hyperlinking. (fab61bb)

git at git.haskell.org git at git.haskell.org
Wed Jul 8 08:40:15 UTC 2015


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

On branch  : master
Link       : http://git.haskell.org/haddock.git/commitdiff/fab61bb80c2d8059e91aece7677cf349cd34a8db

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

commit fab61bb80c2d8059e91aece7677cf349cd34a8db
Author: Łukasz Hanuszczak <lukasz.hanuszczak at gmail.com>
Date:   Mon Jun 8 15:05:35 2015 +0200

    Fix span matching to allow parenthesized operators hyperlinking.


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

fab61bb80c2d8059e91aece7677cf349cd34a8db
 haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
index 2325aa2..05d6a52 100644
--- a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
+++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
@@ -101,10 +101,10 @@ imports =
 
 matches :: Span -> GHC.SrcSpan -> Bool
 matches tspan (GHC.RealSrcSpan aspan)
-    | rs && cs && re && ce = True
+    | saspan <= stspan && etspan <= easpan = True
   where
-    rs = (posRow . spStart) tspan == GHC.srcSpanStartLine aspan
-    cs = (posCol . spStart) tspan == GHC.srcSpanStartCol aspan
-    re = (posRow . spEnd) tspan == GHC.srcSpanEndLine aspan
-    ce = (posCol . spEnd) tspan == GHC.srcSpanEndCol aspan
+    stspan = (posRow . spStart $ tspan, posCol . spStart $ tspan)
+    etspan = (posRow . spEnd $ tspan, posCol . spEnd $ tspan)
+    saspan = (GHC.srcSpanStartLine aspan, GHC.srcSpanStartCol aspan)
+    easpan = (GHC.srcSpanEndLine aspan, GHC.srcSpanEndCol aspan)
 matches _ _ = False



More information about the ghc-commits mailing list