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/deSugar/DsBinds.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/deSugar/DsBinds.hs')
-rw-r--r-- | compiler/deSugar/DsBinds.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/deSugar/DsBinds.hs b/compiler/deSugar/DsBinds.hs index ae23a765c4..41aeb93f21 100644 --- a/compiler/deSugar/DsBinds.hs +++ b/compiler/deSugar/DsBinds.hs @@ -80,7 +80,7 @@ dsTopLHsBinds binds -- see Note [Strict binds checks] | not (isEmptyBag unlifted_binds) || not (isEmptyBag bang_binds) = do { mapBagM_ (top_level_err "bindings for unlifted types") unlifted_binds - ; mapBagM_ (top_level_err "strict pattern bindings") bang_binds + ; mapBagM_ (top_level_err "strict bindings") bang_binds ; return nilOL } | otherwise @@ -94,7 +94,7 @@ dsTopLHsBinds binds where unlifted_binds = filterBag (isUnliftedHsBind . unLoc) binds - bang_binds = filterBag (isBangedPatBind . unLoc) binds + bang_binds = filterBag (isBangedHsBind . unLoc) binds top_level_err desc (L loc bind) = putSrcSpanDs loc $ @@ -152,7 +152,7 @@ dsHsBind dflags b@(FunBind { fun_id = L _ fun, fun_matches = matches | xopt LangExt.Strict dflags , matchGroupArity matches == 0 -- no need to force lambdas = [id] - | isBangedBind b + | isBangedHsBind b = [id] | otherwise = [] @@ -603,7 +603,7 @@ We define an "unlifted bind" to be any bind that binds an unlifted id. Note that is *not* an unlifted bind. Unlifted binds are detected by HsUtils.isUnliftedHsBind. -Define a "banged bind" to have a top-level bang. Detected by HsPat.isBangedPatBind. +Define a "banged bind" to have a top-level bang. Detected by HsPat.isBangedHsBind. Define a "strict bind" to be either an unlifted bind or a banged bind. The restrictions are: |