on master help sign in
Fix an issue in module chasing caused by unnormalized file paths (#1303)

On Windows we can end up with rootModDir having / in the filepath while rootPathDir uses \ so stripSuffix didn’t work. This fixes #1284

commit1fa783b876a99ae4fac085529c974a8b346b3261 authorMoritz Kiefer <moritz.kiefer@purelyfunctional.org> dateWed 22 May 2019, 13:58 (7 years ago) parenta290aab
1 file changed+6−1
src/Development/IDE/Functions/Compile.hs+6−1
src/Development/IDE/Functions/Compile.hs+6−1
@@ -233,7 +233,12 @@ runGhcSession IdeOptions{..} modu env act = runGhcEnv env $ do
233233moduleImportPaths :: GHC.ParsedModule -> Maybe FilePath
234234moduleImportPaths pm
235235 | rootModDir == "." = Just rootPathDir
236− | otherwise = dropTrailingPathSeparator <$> stripSuffix rootModDir rootPathDir
236+ | otherwise =
237+ -- TODO (MK) stripSuffix (normalise rootModDir) (normalise rootPathDir)
238+ -- would be a better choice but at the moment we do not consistently
239+ -- normalize file paths in the Shake graph so we can end up with the
240+ -- same module being represented twice in the Shake graph.
241+ Just $ dropTrailingPathSeparator $ dropEnd (length rootModDir) rootPathDir
237242 where
238243 ms = GHC.pm_mod_summary pm
239244 file = GHC.ms_hspp_file ms