Skip to content

Commit

Permalink
Canonicalize import dirs (haskell/ghcide#870)
Browse files Browse the repository at this point in the history
* Canonicalize import dirs

* Fix unrelated hlint
  • Loading branch information
pepeiborra committed Oct 15, 2020
1 parent d617da6 commit 897881a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/Development/IDE/GHC/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import RdrName (nameRdrName, rdrNameOcc)

import Development.IDE.GHC.Compat as GHC
import Development.IDE.Types.Location
import System.Directory (canonicalizePath)


----------------------------------------------------------------------
Expand Down Expand Up @@ -189,9 +190,14 @@ data HscEnvEq = HscEnvEq
newHscEnvEq :: FilePath -> HscEnv -> [(InstalledUnitId, DynFlags)] -> IO HscEnvEq
newHscEnvEq cradlePath hscEnv0 deps = do
envUnique <- newUnique
let envImportPaths = Just $ relativeToCradle <$> importPaths (hsc_dflags hscEnv0)
relativeToCradle = (takeDirectory cradlePath </>)
let relativeToCradle = (takeDirectory cradlePath </>)
hscEnv = removeImportPaths hscEnv0

-- Canonicalize import paths since we also canonicalize targets
importPathsCanon <-
mapM canonicalizePath $ relativeToCradle <$> importPaths (hsc_dflags hscEnv0)
let envImportPaths = Just importPathsCanon

return HscEnvEq{..}

newHscEnvEqWithImportPaths :: Maybe [String] -> HscEnv -> [(InstalledUnitId, DynFlags)] -> IO HscEnvEq
Expand Down
2 changes: 1 addition & 1 deletion test/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3010,7 +3010,7 @@ expectFailCabal = expectFailBecause
#endif

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

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

0 comments on commit 897881a

Please sign in to comment.