diff options
author | Ian Lynagh <igloo@earth.li> | 2011-09-30 21:57:53 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2011-10-01 01:45:41 +0100 |
commit | 5b988961338f73af5790bfd365ca79c858249cea (patch) | |
tree | 44b28b8dd216e9a150676abc0da82da9da4b1277 /compiler/rename | |
parent | 53191d55079529dd3682a66e86f2ab9f6479f1bb (diff) | |
download | haskell-5b988961338f73af5790bfd365ca79c858249cea.tar.gz |
Handle newtypes and type functions correctly in FFI types; fixes #3008
You can now use type functions in FFI types.
Newtypes are now only looked through if the constructor is in scope.
Diffstat (limited to 'compiler/rename')
-rw-r--r-- | compiler/rename/RnNames.lhs | 2 | ||||
-rw-r--r-- | compiler/rename/RnSource.lhs | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rename/RnNames.lhs b/compiler/rename/RnNames.lhs index fa8a993ec0..eeaae149a3 100644 --- a/compiler/rename/RnNames.lhs +++ b/compiler/rename/RnNames.lhs @@ -521,7 +521,7 @@ getLocalNonValBinders fixity_env ; return (envs, new_bndrs) } } where for_hs_bndrs :: [Located RdrName] - for_hs_bndrs = [nm | L _ (ForeignImport nm _ _) <- foreign_decls] + for_hs_bndrs = [nm | L _ (ForeignImport nm _ _ _) <- foreign_decls] -- In a hs-boot file, the value binders come from the -- *signatures*, and there should be no foreign binders diff --git a/compiler/rename/RnSource.lhs b/compiler/rename/RnSource.lhs index fc74b25cc2..79876caaf4 100644 --- a/compiler/rename/RnSource.lhs +++ b/compiler/rename/RnSource.lhs @@ -363,7 +363,7 @@ rnDefaultDecl (DefaultDecl tys) \begin{code} rnHsForeignDecl :: ForeignDecl RdrName -> RnM (ForeignDecl Name, FreeVars) -rnHsForeignDecl (ForeignImport name ty spec) +rnHsForeignDecl (ForeignImport name ty _ spec) = do { topEnv :: HscEnv <- getTopEnv ; name' <- lookupLocatedTopBndrRn name ; (ty', fvs) <- rnHsTypeFVs (fo_decl_msg name) ty @@ -372,12 +372,12 @@ rnHsForeignDecl (ForeignImport name ty spec) ; let packageId = thisPackage $ hsc_dflags topEnv spec' = patchForeignImport packageId spec - ; return (ForeignImport name' ty' spec', fvs) } + ; return (ForeignImport name' ty' noForeignImportCoercionYet spec', fvs) } -rnHsForeignDecl (ForeignExport name ty spec) +rnHsForeignDecl (ForeignExport name ty _ spec) = do { name' <- lookupLocatedOccRn name ; (ty', fvs) <- rnHsTypeFVs (fo_decl_msg name) ty - ; return (ForeignExport name' ty' spec, fvs `addOneFV` unLoc name') } + ; return (ForeignExport name' ty' noForeignExportCoercionYet spec, fvs `addOneFV` unLoc name') } -- NB: a foreign export is an *occurrence site* for name, so -- we add it to the free-variable list. It might, for example, -- be imported from another module |