summaryrefslogtreecommitdiff
path: root/compiler/parser/Parser.y
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2017-05-12 16:59:33 -0400
committerBen Gamari <ben@smart-cactus.org>2017-05-12 18:26:51 -0400
commit3032ae81dd14c2eaefa9ecd8880dafa9bda104d9 (patch)
tree0c2dfb95e9faf6f497e2ec4d54893db6c1450a45 /compiler/parser/Parser.y
parent8fd7442efcf6ef0a274f51657633818bd878eb5c (diff)
downloadhaskell-3032ae81dd14c2eaefa9ecd8880dafa9bda104d9.tar.gz
Revert "Treat banged bindings as FunBinds"
This partially reverts commit 372995364c52eef15066132d7d1ea8b6760034e6 as it doesn't actually fix #13594. Namely it does not revert the mkPrefixFunRhs refactoring since this is rather independent from the functional changes. Going to try again with a whole working patch
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 () ;