[commit: ghc] wip/T9705: rnMethodBind: reject pattern synonyms in instance definitions (fixes #9705) (6a50d98)

git at git.haskell.org git at git.haskell.org
Tue Oct 21 12:54:21 UTC 2014


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

On branch  : wip/T9705
Link       : http://ghc.haskell.org/trac/ghc/changeset/6a50d983c079a921679bb7834ea361b70648fc2e/ghc

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

commit 6a50d983c079a921679bb7834ea361b70648fc2e
Author: Dr. ERDI Gergo <gergo at erdi.hu>
Date:   Tue Oct 21 20:51:35 2014 +0800

    rnMethodBind: reject pattern synonyms in instance definitions (fixes #9705)


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

6a50d983c079a921679bb7834ea361b70648fc2e
 compiler/rename/RnBinds.lhs | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/compiler/rename/RnBinds.lhs b/compiler/rename/RnBinds.lhs
index c572e32..553df0b 100644
--- a/compiler/rename/RnBinds.lhs
+++ b/compiler/rename/RnBinds.lhs
@@ -745,6 +745,11 @@ rnMethodBind _ _ (L loc bind@(PatBind {})) = do
     addErrAt loc (methodBindErr bind)
     return (emptyBag, emptyFVs)
 
+-- Associated pattern synonyms are not implemented yet
+rnMethodBind _ _ (L loc bind@(PatSynBind {})) = do
+    addErrAt loc $ methodPatSynErr bind
+    return (emptyBag, emptyFVs)
+
 rnMethodBind _ _ b = pprPanic "rnMethodBind" (ppr b)
 \end{code}
 
@@ -1061,6 +1066,11 @@ methodBindErr mbind
  =  hang (ptext (sLit "Pattern bindings (except simple variables) not allowed in instance declarations"))
        2 (ppr mbind)
 
+methodPatSynErr :: HsBindLR RdrName RdrName -> SDoc
+methodPatSynErr mbind
+ =  hang (ptext (sLit "Pattern synonyms not allowed in instance declarations"))
+       2 (ppr mbind)
+
 bindsInHsBootFile :: LHsBindsLR Name RdrName -> SDoc
 bindsInHsBootFile mbinds
   = hang (ptext (sLit "Bindings in hs-boot files are not allowed"))



More information about the ghc-commits mailing list