summaryrefslogtreecommitdiff
path: root/compiler/parser/Parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/parser/Parser.y')
-rw-r--r--compiler/parser/Parser.y34
1 files changed, 13 insertions, 21 deletions
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
index c525ddf055..7af02053fd 100644
--- a/compiler/parser/Parser.y
+++ b/compiler/parser/Parser.y
@@ -2181,28 +2181,20 @@ docdecld :: { LDocDecl }
decl_no_th :: { LHsDecl RdrName }
: sigdecl { $1 }
- | '!' aexp rhs {% do { let { e = sLL $1 $2 (SectionR (sL1 $1 (HsVar (sL1 $1 bang_RDR))) $2)
- -- Turn it all into an expression so that
- -- checkPattern can check that bangs are enabled
- ; l = comb2 $1 $> };
- (ann, r) <- checkValDef empty SrcStrict e Nothing $3 ;
- -- Depending upon what the pattern looks like we might get either
- -- a FunBind or PatBind back from checkValDef. See Note
- -- [Varieties of binding pattern matches]
- case r of {
- (FunBind n _ _ _ _) ->
- ams (L l ()) [mj AnnFunId n] >> return () ;
- (PatBind (L lh _lhs) _rhs _ _ _) ->
- ams (L lh ()) [] >> return () } ;
-
- _ <- ams (L l ()) (ann ++ fst (unLoc $3)) ;
- return $! (sL l $ ValD r) } }
-
- | infixexp_top opt_sig rhs {% do { (ann,r) <- checkValDef empty NoSrcStrict $1 (snd $2) $3;
+ | '!' aexp rhs {% do { let { e = sLL $1 $2 (SectionR (sL1 $1 (HsVar (sL1 $1 bang_RDR))) $2) };
+ pat <- checkPattern empty e;
+ _ <- ams (sLL $1 $> ())
+ (fst $ unLoc $3);
+ return $ sLL $1 $> $ ValD $
+ PatBind pat (snd $ unLoc $3)
+ placeHolderType
+ placeHolderNames
+ ([],[]) } }
+ -- Turn it all into an expression so that
+ -- checkPattern can check that bangs are enabled
+
+ | infixexp_top opt_sig rhs {% do { (ann,r) <- checkValDef empty $1 (snd $2) $3;
let { l = comb2 $1 $> };
- -- Depending upon what the pattern looks like we might get either
- -- a FunBind or PatBind back from checkValDef. See Note
- -- [Varieties of binding pattern matches]
case r of {
(FunBind n _ _ _ _) ->
ams (L l ()) (mj AnnFunId n:(fst $2)) >> return () ;