[project @ 2002-03-28 09:59:03 by simonmar]
authorsimonmar <unknown>
Thu, 28 Mar 2002 09:59:03 +0000 (09:59 +0000)
committersimonmar <unknown>
Thu, 28 Mar 2002 09:59:03 +0000 (09:59 +0000)
The test suite wins again: re-enable empty contexts in data
declarations.

ghc/compiler/parser/Parser.y

index 88c0ad9..35b8854 100644 (file)
@@ -1,6 +1,6 @@
 {-                                                             -*-haskell-*-
 -----------------------------------------------------------------------------
-$Id: Parser.y,v 1.93 2002/03/14 15:47:54 simonmar Exp $
+$Id: Parser.y,v 1.94 2002/03/28 09:59:03 simonmar Exp $
 
 Haskell grammar.
 
@@ -443,15 +443,23 @@ topdecl :: { RdrBinding }
 --     (Eq a, Ord b) => T a b
 -- Rather a lot of inlining here, else we get reduce/reduce errors
 tycl_hdr :: { (RdrNameContext, RdrName, [RdrNameHsTyVar]) }
-       : '(' comma_types1 ')' '=>' gtycon tv_bndrs     {% mapP checkPred $2    `thenP` \ cxt ->
-                                                          returnP (cxt, $5, $6) }
+       : '(' comma_types1 ')' '=>' gtycon tv_bndrs
+               {% mapP checkPred $2    `thenP` \ cxt ->
+                 returnP (cxt, $5, $6) }
+
+       | '(' ')' '=>' gtycon tv_bndrs
+               { ([], $4, $5) }
+
           -- qtycon for the class below name would lead to many s/r conflicts
          --   FIXME: does the renamer pick up all wrong forms and raise an
          --          error 
-       | gtycon atypes1 '=>' gtycon atypes0            {% checkTyVars $5       `thenP` \ tvs ->
-                                                          returnP ([HsClassP $1 $2], $4, tvs) }
-       | gtycon  atypes0                               {% checkTyVars $2       `thenP` \ tvs ->
-                                                          returnP ([], $1, tvs) }
+       | gtycon atypes1 '=>' gtycon atypes0    
+               {% checkTyVars $5       `thenP` \ tvs ->
+                  returnP ([HsClassP $1 $2], $4, tvs) }
+
+       | gtycon  atypes0
+               {% checkTyVars $2       `thenP` \ tvs ->
+                  returnP ([], $1, tvs) }
                -- We have to have qtycon in this production to avoid s/r
                -- conflicts with the previous one.  The renamer will complain
                -- if we use a qualified tycon.