Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tobias Decking
GHC
Commits
a92a7502
Commit
a92a7502
authored
Oct 10, 2006
by
simonpj@microsoft.com
Browse files
Fail more informatively when a global isn't in the type environment
parent
2a8cdc3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
compiler/typecheck/TcEnv.lhs
View file @
a92a7502
...
...
@@ -66,8 +66,7 @@ import InstEnv ( Instance, DFunId, instanceDFunId, instanceHead )
import DataCon ( DataCon )
import TyCon ( TyCon )
import Class ( Class )
import Name ( Name, NamedThing(..), getSrcLoc, nameModule,
nameOccName )
import Name ( Name, NamedThing(..), getSrcLoc, nameModule_maybe, nameOccName )
import PrelNames ( thFAKE )
import NameEnv
import OccName ( mkDFunOcc, occNameString, mkInstTyTcOcc )
...
...
@@ -114,13 +113,15 @@ tcLookupGlobal name
Nothing -> do
-- Should it have been in the local envt?
{ let mod = nameModule name
; if mod == tcg_mod env || mod == thFAKE then
notFound name -- It should be local, so panic
-- The thFAKE possibility is because it
-- might be in a declaration bracket
else
tcImportDecl name -- Go find it in an interface
{ case nameModule_maybe name of
Nothing -> notFound name -- Internal names can happen in GHCi
Just mod | mod == tcg_mod env -- Names from this module
-> notFound name -- should be in tcg_type_env
| mod == thFAKE -- Names bound in TH declaration brackets
-> notFound name -- should be in tcg_env
| otherwise
-> tcImportDecl name -- Go find it in an interface
}}}}}
tcLookupField :: Name -> TcM Id -- Returns the selector Id
...
...
Write
Preview
Supports
Markdown
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