X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fparser%2FParser.y.pp;h=e009071ebc6d99fe73c0ff9b5d2d92cc97983810;hp=078cfa4374f68c26790e7344ed2c33f323dedc27;hb=60401bfe16c49ef2e06e5e81fd58e030bea02013;hpb=fbff1b7b9c89f6369c4394a0b10fa7c06e011698 diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp index 078cfa4..e009071 100644 --- a/compiler/parser/Parser.y.pp +++ b/compiler/parser/Parser.y.pp @@ -216,7 +216,6 @@ incorrect. 'deriving' { L _ ITderiving } 'do' { L _ ITdo } 'else' { L _ ITelse } - 'generic' { L _ ITgeneric } 'hiding' { L _ IThiding } 'if' { L _ ITif } 'import' { L _ ITimport } @@ -722,6 +721,11 @@ decl_cls :: { Located (OrdList (LHsDecl RdrName)) } decl_cls : at_decl_cls { LL (unitOL (L1 (TyClD (unLoc $1)))) } | decl { $1 } + -- A 'default' signature used with the generic-programming extension + | 'default' infixexp '::' sigtypedoc + {% do { (TypeSig l ty) <- checkValSig $2 $4 + ; return (LL $ unitOL (LL $ SigD (GenericSig l ty))) } } + decls_cls :: { Located (OrdList (LHsDecl RdrName)) } -- Reversed : decls_cls ';' decl_cls { LL (unLoc $1 `appOL` unLoc $3) } | decls_cls ';' { LL (unLoc $1) } @@ -1233,11 +1237,9 @@ gdrh :: { LGRHS RdrName } : '|' guardquals '=' exp { sL (comb2 $1 $>) $ GRHS (unLoc $2) $4 } sigdecl :: { Located (OrdList (LHsDecl RdrName)) } - : 'generic' infixexp '::' sigtypedoc - {% do (TypeSig l ty) <- checkValSig $2 $4 - ; return (LL $ unitOL (LL $ SigD (GenericSig l ty))) } + : -- See Note [Declaration/signature overlap] for why we need infixexp here - | infixexp '::' sigtypedoc + infixexp '::' sigtypedoc {% do s <- checkValSig $1 $3 ; return (LL $ unitOL (LL $ SigD s)) } | var ',' sig_vars '::' sigtypedoc