[project @ 2001-11-08 19:20:55 by sof]
authorsof <unknown>
Thu, 8 Nov 2001 19:20:55 +0000 (19:20 +0000)
committersof <unknown>
Thu, 8 Nov 2001 19:20:55 +0000 (19:20 +0000)
rnHsForeignDecl: 'foreign import's (incl 'f.e.d's) _define_ local toplevel
names, so better use RnEnv.lookupTopBndrRn and not RnEnv.lookupOccRn to
resolve the name.

As was, declaring ForeignImports with the same name as an imported entity
wasn't permitted.

ghc/compiler/rename/RnSource.lhs

index f98124d..b74e3e7 100644 (file)
@@ -130,7 +130,7 @@ rnSourceDecl (DefD (DefaultDecl tys src_loc))
 \begin{code}
 rnHsForeignDecl (ForeignImport name ty spec src_loc)
   = pushSrcLocRn src_loc               $
-    lookupOccRn name                   `thenRn` \ name' ->
+    lookupTopBndrRn name               `thenRn` \ name' ->
     rnHsTypeFVs (fo_decl_msg name) ty  `thenRn` \ (ty', fvs1) ->
     lookupOrigNames (extras spec)      `thenRn` \ fvs2 ->
     returnRn (ForeignImport name' ty' spec src_loc, fvs1 `plusFV` fvs2)