summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/GHC/Unit/Finder.hs13
-rw-r--r--testsuite/tests/driver/Makefile5
-rw-r--r--testsuite/tests/driver/T20569/A.hs1
-rw-r--r--testsuite/tests/driver/T20569/B.hs3
-rw-r--r--testsuite/tests/driver/all.T1
5 files changed, 20 insertions, 3 deletions
diff --git a/compiler/GHC/Unit/Finder.hs b/compiler/GHC/Unit/Finder.hs
index c3c517cb18..45057d13e2 100644
--- a/compiler/GHC/Unit/Finder.hs
+++ b/compiler/GHC/Unit/Finder.hs
@@ -412,6 +412,12 @@ findInstalledHomeModule fc fopts home_unit mod_name = do
home_path = case maybe_working_dir of
Nothing -> finder_importPaths fopts
Just fp -> augmentImports fp (finder_importPaths fopts)
+ hi_dir_path =
+ case finder_hiDir fopts of
+ Just hiDir -> case maybe_working_dir of
+ Nothing -> [hiDir]
+ Just fp -> [fp </> hiDir]
+ Nothing -> home_path
hisuf = finder_hiSuf fopts
mod = mkModule home_unit mod_name
@@ -431,8 +437,9 @@ findInstalledHomeModule fc fopts home_unit mod_name = do
-- In compilation manager modes, we look for source files in the home
-- package because we can compile these automatically. In one-shot
-- compilation mode we look for .hi and .hi-boot files only.
- exts | finder_lookupHomeInterfaces fopts = hi_exts
- | otherwise = source_exts
+ (search_dirs, exts)
+ | finder_lookupHomeInterfaces fopts = (hi_dir_path, hi_exts)
+ | otherwise = (home_path, source_exts)
in
-- special case for GHC.Prim; we won't find it in the filesystem.
@@ -440,7 +447,7 @@ findInstalledHomeModule fc fopts home_unit mod_name = do
-- is a home module).
if mod `installedModuleEq` gHC_PRIM
then return (InstalledFound (error "GHC.Prim ModLocation") mod)
- else searchPathExts home_path mod exts
+ else searchPathExts search_dirs mod exts
-- | Prepend the working directory to the search path.
augmentImports :: FilePath -> [FilePath] -> [FilePath]
diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile
index 9242c2d512..8d47dba2d5 100644
--- a/testsuite/tests/driver/Makefile
+++ b/testsuite/tests/driver/Makefile
@@ -739,3 +739,8 @@ T20316:
"$(TEST_HC)" $(TEST_HC_OPTS) -fno-code T20316.hs -ddump-to-file -ddump-timings;
echo "*** non-module.dump-timings ***"
cat non-module.dump-timings | grep alloc | sed 's/alloc.*//'
+
+.PHONY: T20569
+T20569:
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c T20569/A.hs -i -iT20569 -hidir=interface
+ "$(TEST_HC)" $(TEST_HC_OPTS) -c T20569/B.hs -i -iT20569 -hidir=interface
diff --git a/testsuite/tests/driver/T20569/A.hs b/testsuite/tests/driver/T20569/A.hs
new file mode 100644
index 0000000000..d843c00b78
--- /dev/null
+++ b/testsuite/tests/driver/T20569/A.hs
@@ -0,0 +1 @@
+module A where
diff --git a/testsuite/tests/driver/T20569/B.hs b/testsuite/tests/driver/T20569/B.hs
new file mode 100644
index 0000000000..ce9e7e4932
--- /dev/null
+++ b/testsuite/tests/driver/T20569/B.hs
@@ -0,0 +1,3 @@
+module B where
+
+import A
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
index 07a6ec8c74..92fa6edceb 100644
--- a/testsuite/tests/driver/all.T
+++ b/testsuite/tests/driver/all.T
@@ -304,3 +304,4 @@ test('T20200loop', extra_files(['T20200loop']), multimod_compile,
test('T20316', normal, makefile_test, [])
test('MultiRootsErr', normal, multimod_compile_fail, ['MultiRootsErr', 'MultiRootsErr'])
test('patch-level2', normal, compile, ['-Wcpp-undef'])
+test('T20569', extra_files(["T20569/"]), makefile_test, [])