Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex D
GHC
Commits
ceb67255
Commit
ceb67255
authored
Jun 11, 2011
by
Simon Peyton Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Further improvents to duplicate-export warnings (Trac #2436)
parent
769f5c90
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
11 deletions
+20
-11
compiler/rename/RnNames.lhs
compiler/rename/RnNames.lhs
+20
-11
No files found.
compiler/rename/RnNames.lhs
View file @
ceb67255
...
...
@@ -835,7 +835,7 @@ type ExportAccum -- The type of the accumulating parameter of
emptyExportAccum :: ExportAccum
emptyExportAccum = ([], emptyOccEnv, [])
type ExportOccMap = OccEnv (Name, IE Name)
type ExportOccMap = OccEnv (Name, IE
Rdr
Name)
-- Tracks what a particular exported OccName
-- in an export list refers to, and which item
-- it came from. It's illegal to export two distinct things
...
...
@@ -958,7 +958,7 @@ exports_from_avail (Just rdr_items) rdr_env imports this_mod
then return acc -- Avoid error cascade
else do
occs' <- check_occs
new_
ie occs (availNames avail)
occs' <- check_occs ie occs (availNames avail)
return (L loc new_ie : lie_names, occs', avail : exports)
...
...
@@ -1054,7 +1054,7 @@ isModuleExported implicit_prelude mod (GRE { gre_name = name, gre_prov = prov })
Imported is -> any unQualSpecOK is && any (qualSpecOK mod) is
-------------------------------
check_occs :: IE Name -> ExportOccMap -> [Name] -> RnM ExportOccMap
check_occs :: IE
Rdr
Name -> ExportOccMap -> [Name] -> RnM ExportOccMap
check_occs ie occs names -- 'names' are the entities specifed by 'ie'
= foldlM check occs names
where
...
...
@@ -1079,12 +1079,15 @@ check_occs ie occs names -- 'names' are the entities specifed by 'ie'
name_occ = nameOccName name
dupExport_ok :: Name -> IE
Name -> IE
Name -> Bool
dupExport_ok :: Name -> IE
RdrName -> IE Rdr
Name -> Bool
-- The Name is exported by both IEs. Is that ok?
-- "No" iff the name is mentioned explicitly in both IEs
-- or one of the IEs mentions the name *alone*
-- "Yes" otherwise
--
-- Example of "no": module M( f, f )
-- Examples of "no": module M( f, f )
-- module M( fmap, Functor(..) )
-- module M( module Data.List, head )
--
-- Example of "yes"
-- module M( module A, module B ) where
...
...
@@ -1104,11 +1107,16 @@ dupExport_ok :: Name -> IE Name -> IE Name -> Bool
-- data instance T Int = TInt
dupExport_ok n ie1 ie2
= not (explicit_in ie1 && explicit_in ie2)
= not ( single ie1 || single ie2
|| (explicit_in ie1 && explicit_in ie2) )
where
explicit_in (IEModuleContents _) = False
explicit_in (IEThingAll n') = n == n'
explicit_in _ = True
explicit_in (IEModuleContents _) = False -- module M
explicit_in (IEThingAll r) = nameOccName n == rdrNameOcc r -- T(..)
explicit_in _ = True
single (IEVar {}) = True
single (IEThingAbs {}) = True
single _ = False
\end{code}
%*********************************************************
...
...
@@ -1279,6 +1287,7 @@ warnUnusedImportDecls gbl_env
; let usage :: [ImportDeclUsage]
usage = findImportUsage imports rdr_env (Set.elems uses)
; traceRn (ptext (sLit "Import usage") <+> ppr usage)
; ifDOptM Opt_WarnUnusedImports $
mapM_ warnUnusedImport usage
...
...
@@ -1559,7 +1568,7 @@ typeItemErr name wherestr
= sep [ ptext (sLit "Using 'type' tag on") <+> quotes (ppr name) <+> wherestr,
ptext (sLit "Use -XTypeFamilies to enable this extension") ]
exportClashErr :: GlobalRdrEnv -> Name -> Name -> IE
Name -> IE
Name
exportClashErr :: GlobalRdrEnv -> Name -> Name -> IE
RdrName -> IE Rdr
Name
-> Message
exportClashErr global_env name1 name2 ie1 ie2
= vcat [ ptext (sLit "Conflicting exports for") <+> quotes (ppr occ) <> colon
...
...
@@ -1603,7 +1612,7 @@ addDupDeclErr names@(name : _)
where
sorted_names = sortWith nameSrcLoc names
dupExportWarn :: OccName -> IE
Name -> IE
Name -> SDoc
dupExportWarn :: OccName -> IE
RdrName -> IE Rdr
Name -> SDoc
dupExportWarn occ_name ie1 ie2
= hsep [quotes (ppr occ_name),
ptext (sLit "is exported by"), quotes (ppr ie1),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment