Skip to content

Commit 6af874d

Browse files
authored
Canonicalize import dirs (#870)
* Canonicalize import dirs * Fix unrelated hlint
1 parent 10dbde0 commit 6af874d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/Development/IDE/GHC/Util.hs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ import RdrName (nameRdrName, rdrNameOcc)
7676

7777
import Development.IDE.GHC.Compat as GHC
7878
import Development.IDE.Types.Location
79+
import System.Directory (canonicalizePath)
7980

8081

8182
----------------------------------------------------------------------
@@ -189,9 +190,14 @@ data HscEnvEq = HscEnvEq
189190
newHscEnvEq :: FilePath -> HscEnv -> [(InstalledUnitId, DynFlags)] -> IO HscEnvEq
190191
newHscEnvEq cradlePath hscEnv0 deps = do
191192
envUnique <- newUnique
192-
let envImportPaths = Just $ relativeToCradle <$> importPaths (hsc_dflags hscEnv0)
193-
relativeToCradle = (takeDirectory cradlePath </>)
193+
let relativeToCradle = (takeDirectory cradlePath </>)
194194
hscEnv = removeImportPaths hscEnv0
195+
196+
-- Canonicalize import paths since we also canonicalize targets
197+
importPathsCanon <-
198+
mapM canonicalizePath $ relativeToCradle <$> importPaths (hsc_dflags hscEnv0)
199+
let envImportPaths = Just importPathsCanon
200+
195201
return HscEnvEq{..}
196202

197203
newHscEnvEqWithImportPaths :: Maybe [String] -> HscEnv -> [(InstalledUnitId, DynFlags)] -> IO HscEnvEq

test/exe/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3010,7 +3010,7 @@ expectFailCabal = expectFailBecause
30103010
#endif
30113011

30123012
ignoreInWindowsBecause :: String -> TestTree -> TestTree
3013-
ignoreInWindowsBecause = if isWindows then ignoreTestBecause else flip const
3013+
ignoreInWindowsBecause = if isWindows then ignoreTestBecause else (\_ x -> x)
30143014

30153015
ignoreInWindowsForGHC88And810 :: TestTree -> TestTree
30163016
#if MIN_GHC_API_VERSION(8,8,1) && !MIN_GHC_API_VERSION(9,0,0)

0 commit comments

Comments
 (0)