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
e662c62e
Commit
e662c62e
authored
Jun 24, 2013
by
Simon Peyton Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow associated types as sub-names in an import list (Trac #8011)
parent
d2c3630d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
14 deletions
+20
-14
compiler/rename/RnEnv.lhs
compiler/rename/RnEnv.lhs
+7
-2
compiler/rename/RnNames.lhs
compiler/rename/RnNames.lhs
+13
-12
No files found.
compiler/rename/RnEnv.lhs
View file @
e662c62e
...
...
@@ -25,7 +25,7 @@ module RnEnv (
newLocalBndrRn, newLocalBndrsRn,
bindLocalName, bindLocalNames, bindLocalNamesFV,
MiniFixityEnv,
emptyFsEnv, extendFsEnv, lookupFsEnv,
MiniFixityEnv,
addLocalFixities,
bindLocatedLocalsFV, bindLocatedLocalsRn,
extendTyVarEnvFVRn,
...
...
@@ -36,7 +36,10 @@ module RnEnv (
warnUnusedMatches,
warnUnusedTopBinds, warnUnusedLocalBinds,
dataTcOccs, unknownNameErr, kindSigErr, perhapsForallMsg,
HsDocContext(..), docOfHsDocContext
HsDocContext(..), docOfHsDocContext,
-- FsEnv
FastStringEnv, emptyFsEnv, lookupFsEnv, extendFsEnv, mkFsEnv
) where
#include "HsVersions.h"
...
...
@@ -1035,10 +1038,12 @@ type FastStringEnv a = UniqFM a -- Keyed by FastString
emptyFsEnv :: FastStringEnv a
lookupFsEnv :: FastStringEnv a -> FastString -> Maybe a
extendFsEnv :: FastStringEnv a -> FastString -> a -> FastStringEnv a
mkFsEnv :: [(FastString,a)] -> FastStringEnv a
emptyFsEnv = emptyUFM
lookupFsEnv = lookupUFM
extendFsEnv = addToUFM
mkFsEnv = listToUFM
--------------------------------
type MiniFixityEnv = FastStringEnv (Located Fixity)
...
...
compiler/rename/RnNames.lhs
View file @
e662c62e
...
...
@@ -646,10 +646,16 @@ filterImports iface decl_spec (Just (want_hiding, import_items))
(name, AvailTC name subs, Just parent)
combine x y = pprPanic "filterImports/combine" (ppr x $$ ppr y)
lookup_name :: RdrName -> IELookupM (Name, AvailInfo, Maybe Name)
lookup_name rdr | isQual rdr = failLookupWith (QualImportError rdr)
| Just succ <- mb_success = return succ
| otherwise = failLookupWith BadImport
where
mb_success = lookupOccEnv occ_env (rdrNameOcc rdr)
lookup_lie :: Bool -> LIE RdrName -> TcRn [(LIE Name, AvailInfo)]
lookup_lie opt_typeFamilies (L loc ieRdr)
= do
(stuff, warns) <- setSrcSpan loc .
= do (stuff, warns) <- setSrcSpan loc .
liftM (fromMaybe ([],[])) $
run_lookup (lookup_ie opt_typeFamilies ieRdr)
mapM_ emit_warning warns
...
...
@@ -688,13 +694,6 @@ filterImports iface decl_spec (Just (want_hiding, import_items))
-- different parents). See the discussion at occ_env.
lookup_ie :: Bool -> IE RdrName -> IELookupM ([(IE Name, AvailInfo)], [IELookupWarning])
lookup_ie opt_typeFamilies ie = handle_bad_import $ do
let lookup_name rdr
| isQual rdr
= failLookupWith (QualImportError rdr)
| Just nm <- lookupOccEnv occ_env (rdrNameOcc rdr)
= return nm
| otherwise
= failLookupWith BadImport
case ie of
IEVar n -> do
(name, avail, _) <- lookup_name n
...
...
@@ -734,9 +733,11 @@ filterImports iface decl_spec (Just (want_hiding, import_items))
IEThingWith tc ns -> do
(name, AvailTC _ subnames, mb_parent) <- lookup_name tc
let
env = mkOccEnv [(nameOccName s, s) | s <- subnames]
mb_children = map (lookupOccEnv env . rdrNameOcc) ns
-- Look up the children in the sub-names of the parent
let kid_env = mkFsEnv [(occNameFS (nameOccName n), n) | n <- subnames]
mb_children = map (lookupFsEnv kid_env . occNameFS . rdrNameOcc) ns
children <- if any isNothing mb_children
then failLookupWith BadImport
else return (catMaybes mb_children)
...
...
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