X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FFinder.lhs;h=cc19e317cde7825115da0cccf5abe0e8efb9d30f;hb=703ca1542c8e0983cc9d8eebce6e9f3dd3fd71e2;hp=b923b92223b34a489bbf711707bbdab26e74de0f;hpb=305b24aa09287ce3d3b5e9817a5be745e0f17232;p=ghc-hetmet.git
diff --git a/compiler/main/Finder.lhs b/compiler/main/Finder.lhs
index b923b92..cc19e31 100644
--- a/compiler/main/Finder.lhs
+++ b/compiler/main/Finder.lhs
@@ -10,6 +10,7 @@ module Finder (
findImportedModule,
findExactModule,
findHomeModule,
+ findExposedPackageModule,
mkHomeModLocation,
mkHomeModLocation2,
mkHiOnlyModLocation,
@@ -39,10 +40,8 @@ import Maybes ( expectJust )
import Distribution.Package hiding (PackageId)
import Data.IORef ( IORef, writeIORef, readIORef, modifyIORef )
-import Data.List
import System.Directory
import System.FilePath
-import System.IO
import Control.Monad
import System.Time ( ClockTime )
@@ -498,23 +497,14 @@ mkStubPaths dflags mod location
stub_basename = stub_basename0 ++ "_stub"
- -- this is the filename we're going to use when
- -- \#including the stub_h file from the .hc file.
- -- Without -stubdir, we just #include the basename
- -- (eg. for a module A.B, we #include "B_stub.h"),
- -- relying on the fact that we add an implicit -I flag
- -- for the directory in which the source file resides
- -- (see DriverPipeline.hs). With -stubdir, we
- -- \#include "A/B.h", assuming that the user has added
- -- -I
along with -stubdir .
- include_basename
- | Just _ <- stubdir = mod_basename
- | otherwise = takeFileName src_basename
+ obj = ml_obj_file location
+ osuf = objectSuf dflags
+ stub_obj_base = dropTail (length osuf + 1) obj ++ "_stub"
+ -- NB. not takeFileName, see #3093
in
(stub_basename <.> "c",
stub_basename <.> "h",
- (include_basename ++ "_stub") <.> "h")
- -- the _stub.o filename is derived from the ml_obj_file.
+ stub_obj_base <.> objectSuf dflags)
-- -----------------------------------------------------------------------------
-- findLinkable isn't related to the other stuff in here,
@@ -543,17 +533,20 @@ findObjectLinkable mod obj_fn obj_time = do
cannotFindModule :: DynFlags -> ModuleName -> FindResult -> SDoc
cannotFindModule = cantFindErr (sLit "Could not find module")
+ (sLit "Ambiguous module name")
cannotFindInterface :: DynFlags -> ModuleName -> FindResult -> SDoc
cannotFindInterface = cantFindErr (sLit "Failed to load interface for")
+ (sLit "Ambiguous interface for")
-cantFindErr :: LitString -> DynFlags -> ModuleName -> FindResult -> SDoc
-cantFindErr cannot_find _dflags mod_name (FoundMultiple pkgs)
- = hang (ptext cannot_find <+> quotes (ppr mod_name) <> colon) 2 (
+cantFindErr :: LitString -> LitString -> DynFlags -> ModuleName -> FindResult
+ -> SDoc
+cantFindErr _ multiple_found _ mod_name (FoundMultiple pkgs)
+ = hang (ptext multiple_found <+> quotes (ppr mod_name) <> colon) 2 (
sep [ptext (sLit "it was found in multiple packages:"),
hsep (map (text.packageIdString) pkgs)]
)
-cantFindErr cannot_find dflags mod_name find_result
+cantFindErr cannot_find _ dflags mod_name find_result
= hang (ptext cannot_find <+> quotes (ppr mod_name) <> colon)
2 more_info
where