summaryrefslogtreecommitdiff
path: root/compiler/GHC/Rename/Module.hs
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2021-05-02 04:03:38 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-03 19:52:34 -0400
commit24a9b1708cee95670e7ec2a6ceb68e29fc376cf7 (patch)
treeb6c5ffadf9d3bb8c999070886103d7fffbd0fe19 /compiler/GHC/Rename/Module.hs
parent7f5ee7194e18cc2c922839260817c16db8e95832 (diff)
downloadhaskell-24a9b1708cee95670e7ec2a6ceb68e29fc376cf7.tar.gz
Improve hs-boot binds error (#19781)
Diffstat (limited to 'compiler/GHC/Rename/Module.hs')
-rw-r--r--compiler/GHC/Rename/Module.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/GHC/Rename/Module.hs b/compiler/GHC/Rename/Module.hs
index 8de0c4a34f..1b54b53716 100644
--- a/compiler/GHC/Rename/Module.hs
+++ b/compiler/GHC/Rename/Module.hs
@@ -140,7 +140,12 @@ rnSrcDecls group@(HsGroup { hs_valds = val_decls,
-- (D2) Rename the left-hand sides of the value bindings.
-- This depends on everything from (B) being in scope.
-- It uses the fixity env from (A) to bind fixities for view patterns.
- new_lhs <- rnTopBindsLHS local_fix_env val_decls ;
+
+ -- We need to throw an error on such value bindings when in a boot file.
+ is_boot <- tcIsHsBootOrSig ;
+ new_lhs <- if is_boot
+ then rnTopBindsLHSBoot local_fix_env val_decls
+ else rnTopBindsLHS local_fix_env val_decls ;
-- Bind the LHSes (and their fixities) in the global rdr environment
let { id_bndrs = collectHsIdBinders CollNoDictBinders new_lhs } ;
@@ -168,7 +173,6 @@ rnSrcDecls group@(HsGroup { hs_valds = val_decls,
-- (F) Rename Value declarations right-hand sides
traceRn "Start rnmono" empty ;
let { val_bndr_set = mkNameSet id_bndrs `unionNameSet` mkNameSet pat_syn_bndrs } ;
- is_boot <- tcIsHsBootOrSig ;
(rn_val_decls, bind_dus) <- if is_boot
-- For an hs-boot, use tc_bndrs (which collects how we're renamed
-- signatures), since val_bndr_set is empty (there are no x = ...