diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2017-07-31 13:22:38 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2017-07-31 13:36:49 +0100 |
commit | af89d6872da2e00be738e1ac541346cd84e6d141 (patch) | |
tree | 5f7636610dccb71880580d4e3b13820a503fb8de /compiler/hsSyn/HsPat.hs | |
parent | 3ab342eb1b82ba9218a9d7786c523b1128b2bdf1 (diff) | |
download | haskell-af89d6872da2e00be738e1ac541346cd84e6d141.tar.gz |
Reject top-level banged bindings
Bizarrely, we were not rejecting
!x = e
Fix:
* In the test in DsBinds.dsTopLHsBinds, use isBangedHsBind, not
isBangedPatBind. (Indeed the latter dies altogther.)
* Implement isBangedHsBind in HsUtils;
be sure to handle AbsBinds
All this was shown up by Trac #13594
Diffstat (limited to 'compiler/hsSyn/HsPat.hs')
-rw-r--r-- | compiler/hsSyn/HsPat.hs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/compiler/hsSyn/HsPat.hs b/compiler/hsSyn/HsPat.hs index edf2e1b349..5caf1a0f6c 100644 --- a/compiler/hsSyn/HsPat.hs +++ b/compiler/hsSyn/HsPat.hs @@ -29,7 +29,7 @@ module HsPat ( mkPrefixConPat, mkCharLitPat, mkNilPat, looksLazyPatBind, - isBangedLPat, isBangedPatBind, + isBangedLPat, hsPatNeedsParens, isIrrefutableHsPat, @@ -558,10 +558,6 @@ patterns are treated specially, of course. The 1.3 report defines what ``irrefutable'' and ``failure-free'' patterns are. -} -isBangedPatBind :: HsBind p -> Bool -isBangedPatBind (PatBind {pat_lhs = pat}) = isBangedLPat pat -isBangedPatBind _ = False - isBangedLPat :: LPat p -> Bool isBangedLPat (L _ (ParPat p)) = isBangedLPat p isBangedLPat (L _ (BangPat {})) = True |