[commit: ghc] master: API Annotaions:add name in PatBind Match (cb989e2)

git at git.haskell.org git at git.haskell.org
Wed Dec 23 11:28:51 UTC 2015


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

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

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

commit cb989e2f71bbd31aa6b3729030034167d8f8a1ca
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   Wed Dec 23 12:44:23 2015 +0200

    API Annotaions:add name in PatBind Match
    
    A PatBind operates similarly to a FunBind, and so the RdrName and
    infix/prefix state needs to be captured for use in API Annotations.


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

cb989e2f71bbd31aa6b3729030034167d8f8a1ca
 compiler/parser/RdrHsSyn.hs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs
index e84f8af..d8c8b3a 100644
--- a/compiler/parser/RdrHsSyn.hs
+++ b/compiler/parser/RdrHsSyn.hs
@@ -471,13 +471,13 @@ mkPatSynMatchGroup (L loc patsyn_name) (L _ decls) =
        ; when (length matches /= 1) (wrongNumberErr loc)
        ; return $ mkMatchGroup FromSource matches }
   where
-    fromDecl (L loc decl@(ValD (PatBind pat@(L _ (ConPatIn (L _ name) details)) rhs _ _ _))) =
+    fromDecl (L loc decl@(ValD (PatBind pat@(L _ (ConPatIn ln@(L _ name) details)) rhs _ _ _))) =
         do { unless (name == patsyn_name) $
                wrongNameBindingErr loc decl
            ; match <- case details of
-               PrefixCon pats -> return $ Match NonFunBindMatch pats Nothing rhs
+               PrefixCon pats -> return $ Match (FunBindMatch ln False) pats Nothing rhs
                InfixCon pat1 pat2 ->
-                         return $ Match NonFunBindMatch [pat1, pat2] Nothing rhs
+                         return $ Match (FunBindMatch ln True) [pat1, pat2] Nothing rhs
                RecCon{} -> recordPatSynErr loc pat
            ; return $ L loc match }
     fromDecl (L loc decl) = extraDeclErr loc decl



More information about the ghc-commits mailing list