From 1fa783b876a99ae4fac085529c974a8b346b3261 Mon Sep 17 00:00:00 2001 From: Moritz Kiefer Date: Wed, 22 May 2019 13:58:22 +0200 Subject: [PATCH] Fix an issue in module chasing caused by unnormalized file paths (#1303) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows we can end up with rootModDir having / in the filepath while rootPathDir uses \ so stripSuffix didn’t work. This fixes #1284 --- src/Development/IDE/Functions/Compile.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Development/IDE/Functions/Compile.hs b/src/Development/IDE/Functions/Compile.hs index 1613df85..ca0cacb9 100644 --- a/src/Development/IDE/Functions/Compile.hs +++ b/src/Development/IDE/Functions/Compile.hs @@ -233,7 +233,12 @@ runGhcSession IdeOptions{..} modu env act = runGhcEnv env $ do moduleImportPaths :: GHC.ParsedModule -> Maybe FilePath moduleImportPaths pm | rootModDir == "." = Just rootPathDir - | otherwise = dropTrailingPathSeparator <$> stripSuffix rootModDir rootPathDir + | otherwise = + -- TODO (MK) stripSuffix (normalise rootModDir) (normalise rootPathDir) + -- would be a better choice but at the moment we do not consistently + -- normalize file paths in the Shake graph so we can end up with the + -- same module being represented twice in the Shake graph. + Just $ dropTrailingPathSeparator $ dropEnd (length rootModDir) rootPathDir where ms = GHC.pm_mod_summary pm file = GHC.ms_hspp_file ms