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
jberryman
GHC
Commits
c0c4923f
Commit
c0c4923f
authored
Mar 22, 2001
by
simonpj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[project @ 2001-03-22 11:19:28 by simonpj]
Improve error reporting for signatures not in scope
parent
2d4a0023
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
9 deletions
+22
-9
ghc/compiler/rename/RnEnv.lhs
ghc/compiler/rename/RnEnv.lhs
+22
-9
No files found.
ghc/compiler/rename/RnEnv.lhs
View file @
c0c4923f
...
...
@@ -14,7 +14,7 @@ import HscTypes ( ModIface(..) )
import HsSyn
import RdrHsSyn ( RdrNameIE )
import RdrName ( RdrName, rdrNameModule, rdrNameOcc, isQual, isUnqual, isOrig,
mkRdrUnqual, mkRdrQual,
qualifyRdrName,
lookupRdrEnv, foldRdrEnv
mkRdrUnqual, mkRdrQual, lookupRdrEnv, foldRdrEnv
)
import HsTypes ( hsTyVarName, replaceTyVarName )
import HscTypes ( Provenance(..), pprNameProvenance, hasBetterProv,
...
...
@@ -25,7 +25,7 @@ import HscTypes ( Provenance(..), pprNameProvenance, hasBetterProv,
)
import RnMonad
import Name ( Name,
getSrcLoc,
getSrcLoc,
nameIsLocalOrFrom,
mkLocalName, mkGlobalName,
mkIPName, nameOccName, nameModule_maybe,
setNameModuleAndLoc
...
...
@@ -194,16 +194,29 @@ lookupBndrRn rdr_name
Nothing -> lookupTopBndrRn rdr_name
lookupTopBndrRn rdr_name
-- Look up a top-level local binder. We may be looking up an unqualified 'f',
-- and there may be several imported 'f's too, which must not confuse us.
-- So we have to filter out the non-local ones.
-- A separate function (importsFromLocalDecls) reports duplicate top level
-- decls, so here it's safe just to choose an arbitrary one.
= getModeRn `thenRn` \ mode ->
if isInterfaceMode mode
then lookupIfaceName rdr_name
else -- Source mode, so look up a *qualified* version
-- of the name, so that we get the right one even
-- if there are many with the same occ name
-- There must *be* a binding
getModuleRn `thenRn` \ mod ->
getGlobalNameEnv `thenRn` \ global_env ->
lookupSrcName global_env (qualifyRdrName (moduleName mod) rdr_name)
else
getModuleRn `thenRn` \ mod ->
getGlobalNameEnv `thenRn` \ global_env ->
case lookup_local mod global_env rdr_name of
Just name -> returnRn name
Nothing -> failWithRn (mkUnboundName rdr_name)
(unknownNameErr rdr_name)
where
lookup_local mod global_env rdr_name
= case lookupRdrEnv global_env rdr_name of
Nothing -> Nothing
Just gres -> case [n | GRE n _ _ <- gres, nameIsLocalOrFrom mod n] of
[] -> Nothing
(n:ns) -> Just n
-- lookupSigOccRn is used for type signatures and pragmas
-- Is this valid?
...
...
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