summaryrefslogtreecommitdiff
path: root/compiler/iface
diff options
context:
space:
mode:
authorsimonpj@microsoft.com <unknown>2008-10-03 14:04:23 +0000
committersimonpj@microsoft.com <unknown>2008-10-03 14:04:23 +0000
commit08a9d7341402232672fcff9062454e6ba1ae8bd1 (patch)
tree8b279ffd806873e904eb374e24afe399925a5cc5 /compiler/iface
parent0f853fa103066ba5e3427e824550f038f66da28c (diff)
downloadhaskell-08a9d7341402232672fcff9062454e6ba1ae8bd1.tar.gz
Expunge ThFake, cure Trac #2632
This patch fixes a dirty hack (the fake ThFake module), which in turn was causing Trac #2632. The new scheme is that the top-level binders in a TH [d| ... |] decl splice get Internal names. That breaks a previous invariant that things like TyCons always have External names, but these TyCons are never long-lived; they live only long enough to typecheck the TH quotation; the result is discarded. So it seems cool. Nevertheless -- Template Haskell folk: please test your code. The testsuite is OK but it's conceivable that I've broken something in TH. Let's see.
Diffstat (limited to 'compiler/iface')
-rw-r--r--compiler/iface/IfaceEnv.lhs13
1 files changed, 10 insertions, 3 deletions
diff --git a/compiler/iface/IfaceEnv.lhs b/compiler/iface/IfaceEnv.lhs
index 20d7327cfe..e09ff41d12 100644
--- a/compiler/iface/IfaceEnv.lhs
+++ b/compiler/iface/IfaceEnv.lhs
@@ -114,9 +114,16 @@ newImplicitBinder :: Name -- Base name
-- For source type/class decls, this is the first occurrence
-- For iface ones, the LoadIface has alrady allocated a suitable name in the cache
newImplicitBinder base_name mk_sys_occ
- = newGlobalBinder (nameModule base_name)
- (mk_sys_occ (nameOccName base_name))
- (nameSrcSpan base_name)
+ | Just mod <- nameModule_maybe base_name
+ = newGlobalBinder mod occ loc
+ | otherwise -- When typechecking a [d| decl bracket |],
+ -- TH generates types, classes etc with Internal names,
+ -- so we follow suit for the implicit binders
+ = do { uniq <- newUnique
+ ; return (mkInternalName uniq occ loc) }
+ where
+ occ = mk_sys_occ (nameOccName base_name)
+ loc = nameSrcSpan base_name
ifaceExportNames :: [IfaceExport] -> TcRnIf gbl lcl [AvailInfo]
ifaceExportNames exports = do