Skip to content
Snippets Groups Projects
Commit 2caef4d6 authored by Simon Peyton Jones's avatar Simon Peyton Jones Committed by pcapriotti
Browse files

Fix Trac #7092, involving Template Hsakell and name shadowing

All the mechanism was there, but it wasn't being use for the
name-shadowing test.

MERGED from commit b2e8bed8
parent 428bee9c
No related merge requests found
......@@ -1284,12 +1284,14 @@ checkDupRdrNames rdr_names_w_loc
checkDupNames :: [Name] -> RnM ()
-- Check for duplicated names in a binding group
checkDupNames names
checkDupNames names = check_dup_names (filterOut isSystemName names)
-- See Note [Binders in Template Haskell] in Convert
check_dup_names :: [Name] -> RnM ()
check_dup_names names
= mapM_ (dupNamesErr nameSrcSpan) dups
where
(_, dups) = removeDups (\n1 n2 -> nameOccName n1 `compare` nameOccName n2) $
filterOut isSystemName names
-- See Note [Binders in Template Haskell] in Convert
(_, dups) = removeDups (\n1 n2 -> nameOccName n1 `compare` nameOccName n2) names
---------------------
checkShadowedRdrNames :: [Located RdrName] -> RnM ()
......@@ -1301,10 +1303,12 @@ checkShadowedRdrNames loc_rdr_names
checkDupAndShadowedNames :: (GlobalRdrEnv, LocalRdrEnv) -> [Name] -> RnM ()
checkDupAndShadowedNames envs names
= do { checkDupNames names
= do { check_dup_names filtered_names
; checkShadowedOccs envs loc_occs }
where
loc_occs = [(nameSrcSpan name, nameOccName name) | name <- names]
filtered_names = filterOut isSystemName names
-- See Note [Binders in Template Haskell] in Convert
loc_occs = [(nameSrcSpan name, nameOccName name) | name <- filtered_names]
-------------------------------------
checkShadowedOccs :: (GlobalRdrEnv, LocalRdrEnv) -> [(SrcSpan,OccName)] -> RnM ()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment