Matthew Pickering pushed to branch wip/mp/iface-patches-9.10 at Glasgow Haskell Compiler / GHC

Commits:

20 changed files:

Changes:

  • compiler/GHC.hs
    ... ... @@ -3,7 +3,6 @@
    3 3
     {-# LANGUAGE NondecreasingIndentation, ScopedTypeVariables #-}
    
    4 4
     {-# LANGUAGE TupleSections, NamedFieldPuns #-}
    
    5 5
     {-# LANGUAGE TypeFamilies #-}
    
    6
    -{-# LANGUAGE ExplicitNamespaces #-}
    
    7 6
     {-# LANGUAGE PatternSynonyms #-}
    
    8 7
     
    
    9 8
     -- -----------------------------------------------------------------------------
    
    ... ... @@ -78,6 +77,7 @@ module GHC (
    78 77
             ModuleGraph, emptyMG, mapMG, mkModuleGraph, mgModSummaries,
    
    79 78
             mgLookupModule,
    
    80 79
             ModSummary(..), ms_mod_name, ModLocation(..),
    
    80
    +        pattern ModLocation,
    
    81 81
             getModSummary,
    
    82 82
             getModuleGraph,
    
    83 83
             isLoaded,
    

  • compiler/GHC/Data/OsPath.hs
    ... ... @@ -12,10 +12,14 @@ module GHC.Data.OsPath
    12 12
       , (</>)
    
    13 13
       , (<.>)
    
    14 14
       , splitSearchPath
    
    15
    +  , splitExtension
    
    15 16
       , isRelative
    
    17
    +  , makeRelative
    
    18
    +  , normalise
    
    16 19
       , dropTrailingPathSeparator
    
    17 20
       , takeDirectory
    
    18
    -  , isSuffixOf
    
    21
    +  , OS.isSuffixOf
    
    22
    +  , OS.drop
    
    19 23
       , doesDirectoryExist
    
    20 24
       , doesFileExist
    
    21 25
       , getDirectoryContents
    
    ... ... @@ -31,8 +35,11 @@ import GHC.Utils.Outputable qualified as Outputable
    31 35
     import GHC.Utils.Panic (panic)
    
    32 36
     
    
    33 37
     import System.OsPath
    
    34
    -import System.OsString (isSuffixOf)
    
    38
    +import qualified System.OsString as OS (isSuffixOf, drop)
    
    35 39
     import System.Directory.OsPath (doesDirectoryExist, doesFileExist, getDirectoryContents, createDirectoryIfMissing)
    
    40
    +import GHC.Utils.Panic (panic)
    
    41
    +
    
    42
    +import System.OsPath
    
    36 43
     import System.Directory.Internal (os)
    
    37 44
     
    
    38 45
     -- | Decode an 'OsPath' to 'FilePath', throwing an 'error' if decoding failed.
    

  • compiler/GHC/Data/Strict.hs
    ... ... @@ -9,8 +9,8 @@
    9 9
     module GHC.Data.Strict (
    
    10 10
         Maybe(Nothing, Just),
    
    11 11
         fromMaybe,
    
    12
    +    GHC.Data.Strict.maybe,
    
    12 13
         Pair(And),
    
    13
    -
    
    14 14
         -- Not used at the moment:
    
    15 15
         --
    
    16 16
         -- Either(Left, Right),
    
    ... ... @@ -18,6 +18,7 @@ module GHC.Data.Strict (
    18 18
       ) where
    
    19 19
     
    
    20 20
     import GHC.Prelude hiding (Maybe(..), Either(..))
    
    21
    +
    
    21 22
     import Control.Applicative
    
    22 23
     import Data.Semigroup
    
    23 24
     import Data.Data
    
    ... ... @@ -29,6 +30,10 @@ fromMaybe :: a -> Maybe a -> a
    29 30
     fromMaybe d Nothing = d
    
    30 31
     fromMaybe _ (Just x) = x
    
    31 32
     
    
    33
    +maybe :: b -> (a -> b) -> Maybe a -> b
    
    34
    +maybe d _ Nothing = d
    
    35
    +maybe _ f (Just x) = f x
    
    36
    +
    
    32 37
     apMaybe :: Maybe (a -> b) -> Maybe a -> Maybe b
    
    33 38
     apMaybe (Just f) (Just x) = Just (f x)
    
    34 39
     apMaybe _ _ = Nothing
    

  • compiler/GHC/Driver/Backpack.hs
    ... ... @@ -74,6 +74,7 @@ import GHC.Linker.Types
    74 74
     import qualified GHC.LanguageExtensions as LangExt
    
    75 75
     
    
    76 76
     import GHC.Data.Maybe
    
    77
    +import GHC.Data.OsPath (unsafeEncodeUtf, os)
    
    77 78
     import GHC.Data.StringBuffer
    
    78 79
     import GHC.Data.FastString
    
    79 80
     import qualified GHC.Data.OsPath as OsPath
    
    ... ... @@ -775,7 +776,7 @@ summariseRequirement pn mod_name = do
    775 776
     
    
    776 777
         let PackageName pn_fs = pn
    
    777 778
         let location = mkHomeModLocation2 fopts mod_name
    
    778
    -                    (unpackFS pn_fs </> moduleNameSlashes mod_name) "hsig"
    
    779
    +                    (unsafeEncodeUtf $ unpackFS pn_fs </> moduleNameSlashes mod_name) (os "hsig")
    
    779 780
     
    
    780 781
         env <- getBkpEnv
    
    781 782
         src_hash <- liftIO $ getFileHash (bkp_filename env)
    
    ... ... @@ -859,12 +860,12 @@ hsModuleToModSummary home_keys pn hsc_src modname
    859 860
         -- these filenames to figure out where the hi files go.
    
    860 861
         -- A travesty!
    
    861 862
         let location0 = mkHomeModLocation2 fopts modname
    
    862
    -                             (unpackFS unit_fs </>
    
    863
    +                             (unsafeEncodeUtf $ unpackFS unit_fs </>
    
    863 864
                                   moduleNameSlashes modname)
    
    864 865
                                   (case hsc_src of
    
    865
    -                                HsigFile   -> "hsig"
    
    866
    -                                HsBootFile -> "hs-boot"
    
    867
    -                                HsSrcFile  -> "hs")
    
    866
    +                                HsigFile   -> os "hsig"
    
    867
    +                                HsBootFile -> os "hs-boot"
    
    868
    +                                HsSrcFile  -> os "hs")
    
    868 869
         -- DANGEROUS: bootifying can POISON the module finder cache
    
    869 870
         let location = case hsc_src of
    
    870 871
                             HsBootFile -> addBootSuffixLocnOut location0
    

  • compiler/GHC/Driver/CodeOutput.hs
    ... ... @@ -35,6 +35,7 @@ import GHC.Driver.LlvmConfigCache (LlvmConfigCache)
    35 35
     import GHC.Driver.Ppr
    
    36 36
     import GHC.Driver.Backend
    
    37 37
     
    
    38
    +import GHC.Data.OsPath (unsafeDecodeUtf)
    
    38 39
     import qualified GHC.Data.ShortText as ST
    
    39 40
     import GHC.Data.Stream           ( Stream )
    
    40 41
     import qualified GHC.Data.Stream as Stream
    
    ... ... @@ -259,7 +260,7 @@ outputForeignStubs
    259 260
                Maybe FilePath) -- C file created
    
    260 261
     outputForeignStubs logger tmpfs dflags unit_state mod location stubs
    
    261 262
      = do
    
    262
    -   let stub_h = mkStubPaths (initFinderOpts dflags) (moduleName mod) location
    
    263
    +   let stub_h = unsafeDecodeUtf $ mkStubPaths (initFinderOpts dflags) (moduleName mod) location
    
    263 264
        stub_c <- newTempName logger tmpfs (tmpDir dflags) TFL_CurrentModule "c"
    
    264 265
     
    
    265 266
        case stubs of
    

  • compiler/GHC/Driver/Config/Finder.hs
    ... ... @@ -8,27 +8,27 @@ import GHC.Prelude
    8 8
     import GHC.Driver.DynFlags
    
    9 9
     import GHC.Unit.Finder.Types
    
    10 10
     import GHC.Data.FastString
    
    11
    -
    
    11
    +import GHC.Data.OsPath
    
    12 12
     
    
    13 13
     -- | Create a new 'FinderOpts' from DynFlags.
    
    14 14
     initFinderOpts :: DynFlags -> FinderOpts
    
    15 15
     initFinderOpts flags = FinderOpts
    
    16
    -  { finder_importPaths = importPaths flags
    
    16
    +  { finder_importPaths = fmap unsafeEncodeUtf $ importPaths flags
    
    17 17
       , finder_lookupHomeInterfaces = isOneShot (ghcMode flags)
    
    18 18
       , finder_bypassHiFileCheck = MkDepend == (ghcMode flags)
    
    19 19
       , finder_ways = ways flags
    
    20 20
       , finder_enableSuggestions = gopt Opt_HelpfulErrors flags
    
    21
    -  , finder_workingDirectory = workingDirectory flags
    
    21
    +  , finder_workingDirectory = fmap unsafeEncodeUtf $ workingDirectory flags
    
    22 22
       , finder_thisPackageName  = mkFastString <$> thisPackageName flags
    
    23 23
       , finder_hiddenModules = hiddenModules flags
    
    24 24
       , finder_reexportedModules = reexportedModules flags
    
    25
    -  , finder_hieDir = hieDir flags
    
    26
    -  , finder_hieSuf = hieSuf flags
    
    27
    -  , finder_hiDir = hiDir flags
    
    28
    -  , finder_hiSuf = hiSuf_ flags
    
    29
    -  , finder_dynHiSuf = dynHiSuf_ flags
    
    30
    -  , finder_objectDir = objectDir flags
    
    31
    -  , finder_objectSuf = objectSuf_ flags
    
    32
    -  , finder_dynObjectSuf = dynObjectSuf_ flags
    
    33
    -  , finder_stubDir = stubDir flags
    
    25
    +  , finder_hieDir = fmap unsafeEncodeUtf $ hieDir flags
    
    26
    +  , finder_hieSuf = unsafeEncodeUtf $ hieSuf flags
    
    27
    +  , finder_hiDir = fmap unsafeEncodeUtf $ hiDir flags
    
    28
    +  , finder_hiSuf = unsafeEncodeUtf $ hiSuf_ flags
    
    29
    +  , finder_dynHiSuf = unsafeEncodeUtf $ dynHiSuf_ flags
    
    30
    +  , finder_objectDir = fmap unsafeEncodeUtf $ objectDir flags
    
    31
    +  , finder_objectSuf = unsafeEncodeUtf $ objectSuf_ flags
    
    32
    +  , finder_dynObjectSuf = unsafeEncodeUtf $ dynObjectSuf_ flags
    
    33
    +  , finder_stubDir = fmap unsafeEncodeUtf $ stubDir flags
    
    34 34
       }

  • compiler/GHC/Driver/Main.hs
    ... ... @@ -264,6 +264,7 @@ import qualified GHC.LanguageExtensions as LangExt
    264 264
     
    
    265 265
     import GHC.Data.FastString
    
    266 266
     import GHC.Data.Bag
    
    267
    +import GHC.Data.OsPath (unsafeEncodeUtf)
    
    267 268
     import GHC.Data.StringBuffer
    
    268 269
     import qualified GHC.Data.Stream as Stream
    
    269 270
     import GHC.Data.Stream (Stream)
    
    ... ... @@ -2131,12 +2132,13 @@ hscCompileCmmFile hsc_env original_filename filename output_filename = runHsc hs
    2131 2132
                  rawCmms
    
    2132 2133
             return stub_c_exists
    
    2133 2134
       where
    
    2134
    -    no_loc = ModLocation{ ml_hs_file  = Just original_filename,
    
    2135
    -                          ml_hi_file  = panic "hscCompileCmmFile: no hi file",
    
    2136
    -                          ml_obj_file = panic "hscCompileCmmFile: no obj file",
    
    2137
    -                          ml_dyn_obj_file = panic "hscCompileCmmFile: no dyn obj file",
    
    2138
    -                          ml_dyn_hi_file  = panic "hscCompileCmmFile: no dyn obj file",
    
    2139
    -                          ml_hie_file = panic "hscCompileCmmFile: no hie file"}
    
    2135
    +    no_loc = OsPathModLocation
    
    2136
    +        { ml_hs_file_ospath  = Just $ unsafeEncodeUtf original_filename,
    
    2137
    +          ml_hi_file_ospath  = panic "hscCompileCmmFile: no hi file",
    
    2138
    +          ml_obj_file_ospath = panic "hscCompileCmmFile: no obj file",
    
    2139
    +          ml_dyn_obj_file_ospath = panic "hscCompileCmmFile: no dyn obj file",
    
    2140
    +          ml_dyn_hi_file_ospath  = panic "hscCompileCmmFile: no dyn obj file",
    
    2141
    +          ml_hie_file_ospath = panic "hscCompileCmmFile: no hie file"}
    
    2140 2142
     
    
    2141 2143
     -------------------- Stuff for new code gen ---------------------
    
    2142 2144
     
    
    ... ... @@ -2370,12 +2372,13 @@ hscParsedDecls hsc_env decls = runInteractiveHsc hsc_env $ do
    2370 2372
     
    
    2371 2373
         {- Desugar it -}
    
    2372 2374
         -- We use a basically null location for iNTERACTIVE
    
    2373
    -    let iNTERACTIVELoc = ModLocation{ ml_hs_file   = Nothing,
    
    2374
    -                                      ml_hi_file   = panic "hsDeclsWithLocation:ml_hi_file",
    
    2375
    -                                      ml_obj_file  = panic "hsDeclsWithLocation:ml_obj_file",
    
    2376
    -                                      ml_dyn_obj_file = panic "hsDeclsWithLocation:ml_dyn_obj_file",
    
    2377
    -                                      ml_dyn_hi_file = panic "hsDeclsWithLocation:ml_dyn_hi_file",
    
    2378
    -                                      ml_hie_file  = panic "hsDeclsWithLocation:ml_hie_file" }
    
    2375
    +    let iNTERACTIVELoc = OsPathModLocation
    
    2376
    +            { ml_hs_file_ospath   = Nothing,
    
    2377
    +              ml_hi_file_ospath   = panic "hsDeclsWithLocation:ml_hi_file_ospath",
    
    2378
    +              ml_obj_file_ospath  = panic "hsDeclsWithLocation:ml_obj_file_ospath",
    
    2379
    +              ml_dyn_obj_file_ospath = panic "hsDeclsWithLocation:ml_dyn_obj_file_ospath",
    
    2380
    +              ml_dyn_hi_file_ospath = panic "hsDeclsWithLocation:ml_dyn_hi_file_ospath",
    
    2381
    +              ml_hie_file_ospath  = panic "hsDeclsWithLocation:ml_hie_file_ospath" }
    
    2379 2382
         ds_result <- hscDesugar' iNTERACTIVELoc tc_gblenv
    
    2380 2383
     
    
    2381 2384
         {- Simplify -}
    
    ... ... @@ -2655,12 +2658,13 @@ hscCompileCoreExpr' hsc_env srcspan ds_expr = do
    2655 2658
     
    
    2656 2659
       {- Lint if necessary -}
    
    2657 2660
       lintInteractiveExpr (text "hscCompileCoreExpr") hsc_env prepd_expr
    
    2658
    -  let this_loc = ModLocation{ ml_hs_file   = Nothing,
    
    2659
    -                              ml_hi_file   = panic "hscCompileCoreExpr':ml_hi_file",
    
    2660
    -                              ml_obj_file  = panic "hscCompileCoreExpr':ml_obj_file",
    
    2661
    -                              ml_dyn_obj_file = panic "hscCompileCoreExpr': ml_obj_file",
    
    2662
    -                              ml_dyn_hi_file  = panic "hscCompileCoreExpr': ml_dyn_hi_file",
    
    2663
    -                              ml_hie_file  = panic "hscCompileCoreExpr':ml_hie_file" }
    
    2661
    +  let this_loc = OsPathModLocation
    
    2662
    +          { ml_hs_file_ospath   = Nothing,
    
    2663
    +            ml_hi_file_ospath   = panic "hscCompileCoreExpr':ml_hi_file_ospath",
    
    2664
    +            ml_obj_file_ospath  = panic "hscCompileCoreExpr':ml_obj_file_ospath",
    
    2665
    +            ml_dyn_obj_file_ospath = panic "hscCompileCoreExpr': ml_obj_file_ospath",
    
    2666
    +            ml_dyn_hi_file_ospath  = panic "hscCompileCoreExpr': ml_dyn_hi_file_ospath",
    
    2667
    +            ml_hie_file_ospath  = panic "hscCompileCoreExpr':ml_hie_file_ospath" }
    
    2664 2668
     
    
    2665 2669
       -- Ensure module uniqueness by giving it a name like "GhciNNNN".
    
    2666 2670
       -- This uniqueness is needed by the JS linker. Without it we break the 1-1
    

  • compiler/GHC/Driver/Make.hs
    ... ... @@ -79,6 +79,7 @@ import GHC.Data.Bag ( listToBag )
    79 79
     import GHC.Data.Graph.Directed
    
    80 80
     import GHC.Data.FastString
    
    81 81
     import GHC.Data.Maybe      ( expectJust )
    
    82
    +import GHC.Data.OsPath     ( unsafeEncodeUtf )
    
    82 83
     import GHC.Data.StringBuffer
    
    83 84
     import qualified GHC.LanguageExtensions as LangExt
    
    84 85
     
    
    ... ... @@ -1913,7 +1914,7 @@ enableCodeGenWhen logger tmpfs staticLife dynLife unit_env mod_graph =
    1913 1914
                          tn <- newTempName logger tmpfs (tmpDir dflags) staticLife suf
    
    1914 1915
                          let dyn_tn = tn -<.> dynsuf
    
    1915 1916
                          addFilesToClean tmpfs dynLife [dyn_tn]
    
    1916
    -                     return (tn, dyn_tn)
    
    1917
    +                     return (unsafeEncodeUtf tn, unsafeEncodeUtf dyn_tn)
    
    1917 1918
                      -- We don't want to create .o or .hi files unless we have been asked
    
    1918 1919
                      -- to by the user. But we need them, so we patch their locations in
    
    1919 1920
                      -- the ModSummary with temporary files.
    
    ... ... @@ -1922,8 +1923,8 @@ enableCodeGenWhen logger tmpfs staticLife dynLife unit_env mod_graph =
    1922 1923
                      -- If ``-fwrite-interface` is specified, then the .o and .hi files
    
    1923 1924
                      -- are written into `-odir` and `-hidir` respectively.  #16670
    
    1924 1925
                      if gopt Opt_WriteInterface dflags
    
    1925
    -                   then return ((ml_hi_file ms_location, ml_dyn_hi_file ms_location)
    
    1926
    -                               , (ml_obj_file ms_location, ml_dyn_obj_file ms_location))
    
    1926
    +                   then return ((ml_hi_file_ospath ms_location, ml_dyn_hi_file_ospath ms_location)
    
    1927
    +                               , (ml_obj_file_ospath ms_location, ml_dyn_obj_file_ospath ms_location))
    
    1927 1928
                        else (,) <$> (new_temp_file (hiSuf_ dflags) (dynHiSuf_ dflags))
    
    1928 1929
                                 <*> (new_temp_file (objectSuf_ dflags) (dynObjectSuf_ dflags))
    
    1929 1930
                    let new_dflags = case enable_spec of
    
    ... ... @@ -1932,10 +1933,10 @@ enableCodeGenWhen logger tmpfs staticLife dynLife unit_env mod_graph =
    1932 1933
                                       EnableByteCodeAndObject -> (gopt_set dflags Opt_ByteCodeAndObjectCode) { backend = defaultBackendOf ms}
    
    1933 1934
                    let ms' = ms
    
    1934 1935
                          { ms_location =
    
    1935
    -                         ms_location { ml_hi_file = hi_file
    
    1936
    -                                     , ml_obj_file = o_file
    
    1937
    -                                     , ml_dyn_hi_file = dyn_hi_file
    
    1938
    -                                     , ml_dyn_obj_file = dyn_o_file }
    
    1936
    +                         ms_location { ml_hi_file_ospath = hi_file
    
    1937
    +                                     , ml_obj_file_ospath = o_file
    
    1938
    +                                     , ml_dyn_hi_file_ospath = dyn_hi_file
    
    1939
    +                                     , ml_dyn_obj_file_ospath = dyn_o_file }
    
    1939 1940
                          , ms_hspp_opts = updOptLevel 0 $ new_dflags
    
    1940 1941
                          }
    
    1941 1942
                    -- Recursive call to catch the other cases
    
    ... ... @@ -2121,7 +2122,7 @@ summariseFile hsc_env' home_unit old_summaries src_fn mb_phase maybe_buf
    2121 2122
             let fopts = initFinderOpts (hsc_dflags hsc_env)
    
    2122 2123
     
    
    2123 2124
             -- Make a ModLocation for this file
    
    2124
    -        let location = mkHomeModLocation fopts pi_mod_name src_fn
    
    2125
    +        let location = mkHomeModLocation fopts pi_mod_name (unsafeEncodeUtf src_fn)
    
    2125 2126
     
    
    2126 2127
             -- Tell the Finder cache where it is, so that subsequent calls
    
    2127 2128
             -- to findModule will find it, even if it's not on any search path
    

  • compiler/GHC/Driver/MakeFile.hs
    ... ... @@ -32,6 +32,8 @@ import GHC.Driver.Pipeline.Monad (PipelineOutput (NoOutputFile))
    32 32
     import GHC.Driver.Session (pgm_F)
    
    33 33
     import qualified GHC.SysTools as SysTools
    
    34 34
     import GHC.Data.Graph.Directed ( SCC(..) )
    
    35
    +import GHC.Data.OsPath (unsafeDecodeUtf, OsPath, OsString)
    
    36
    +import qualified GHC.Data.OsPath as OS
    
    35 37
     import GHC.Utils.Outputable
    
    36 38
     import GHC.Utils.Panic
    
    37 39
     import GHC.Types.SourceError
    
    ... ... @@ -243,15 +245,15 @@ processDeps dflags hsc_env excl_mods root hdl m_dep_json (AcyclicSCC (ModuleNode
    243 245
       updateJson m_dep_json (updateDepJSON include_pkg_deps pp dep_node deps)
    
    244 246
       writeDependencies include_pkg_deps root hdl extra_suffixes dep_node deps
    
    245 247
       where
    
    246
    -    extra_suffixes = depSuffixes dflags
    
    248
    +    extra_suffixes = map OS.os (depSuffixes dflags)
    
    247 249
         include_pkg_deps = depIncludePkgDeps dflags
    
    248
    -    src_file = msHsFilePath node
    
    250
    +    src_file = msHsFileOsPath node
    
    249 251
         dep_node =
    
    250 252
           DepNode {
    
    251 253
             dn_mod = ms_mod node,
    
    252 254
             dn_src = src_file,
    
    253
    -        dn_obj = msObjFilePath node,
    
    254
    -        dn_hi = msHiFilePath node,
    
    255
    +        dn_obj = msObjFileOsPath node,
    
    256
    +        dn_hi = msHiFileOsPath node,
    
    255 257
             dn_boot = isBootSummary node,
    
    256 258
             dn_options = Set.fromList (ms_opts node)
    
    257 259
           }
    
    ... ... @@ -285,7 +287,7 @@ processDeps dflags hsc_env excl_mods root hdl m_dep_json (AcyclicSCC (ModuleNode
    285 287
         cpp_deps = do
    
    286 288
           session <- Session <$> newIORef hsc_env
    
    287 289
           parsedMod <- reflectGhc (GHC.parseModule node) session
    
    288
    -      pure (DepCpp <$> GHC.pm_extra_src_files parsedMod)
    
    290
    +      pure (DepCpp . OS.os <$> GHC.pm_extra_src_files parsedMod)
    
    289 291
     
    
    290 292
         -- Emit a dependency for each import
    
    291 293
         import_deps is_boot idecls =
    
    ... ... @@ -309,7 +311,7 @@ findDependency hsc_env srcloc pkg imp dep_boot = do
    309 311
         Found loc dep_mod ->
    
    310 312
           pure DepHi {
    
    311 313
             dep_mod,
    
    312
    -        dep_path = ml_hi_file loc,
    
    314
    +        dep_path = ml_hi_file_ospath loc,
    
    313 315
             dep_unit = lookupUnitId (hsc_units hsc_env) (moduleUnitId dep_mod),
    
    314 316
             dep_local,
    
    315 317
             dep_boot
    
    ... ... @@ -329,7 +331,7 @@ writeDependencies ::
    329 331
       Bool ->
    
    330 332
       FilePath ->
    
    331 333
       Handle ->
    
    332
    -  [FilePath] ->
    
    334
    +  [OsString] ->
    
    333 335
       DepNode ->
    
    334 336
       [Dep] ->
    
    335 337
       IO ()
    
    ... ... @@ -373,7 +375,7 @@ writeDependencies include_pkgs root hdl suffixes node deps =
    373 375
         DepNode {dn_src, dn_obj, dn_hi, dn_boot} = node
    
    374 376
     
    
    375 377
     -----------------------------
    
    376
    -writeDependency :: FilePath -> Handle -> [FilePath] -> FilePath -> IO ()
    
    378
    +writeDependency :: FilePath -> Handle -> [OsPath] -> OsPath -> IO ()
    
    377 379
     -- (writeDependency r h [t1,t2] dep) writes to handle h the dependency
    
    378 380
     --      t1 t2 : dep
    
    379 381
     writeDependency root hdl targets dep
    
    ... ... @@ -381,25 +383,25 @@ writeDependency root hdl targets dep
    381 383
                --     c:/foo/...
    
    382 384
                -- on cygwin as make gets confused by the :
    
    383 385
                -- Making relative deps avoids some instances of this.
    
    384
    -           dep' = makeRelative root dep
    
    385
    -           forOutput = escapeSpaces . reslash Forwards . normalise
    
    386
    +           dep' = OS.makeRelative (OS.os root) dep
    
    387
    +           forOutput = escapeSpaces . reslash Forwards . unsafeDecodeUtf . OS.normalise
    
    386 388
                output = unwords (map forOutput targets) ++ " : " ++ forOutput dep'
    
    387 389
            hPutStrLn hdl output
    
    388 390
     
    
    389 391
     -----------------------------
    
    390 392
     insertSuffixes
    
    391
    -        :: FilePath     -- Original filename;   e.g. "foo.o"
    
    392
    -        -> [String]     -- Suffix prefixes      e.g. ["x_", "y_"]
    
    393
    -        -> [FilePath]   -- Zapped filenames     e.g. ["foo.x_o", "foo.y_o"]
    
    393
    +        :: OsPath     -- Original filename;   e.g. "foo.o"
    
    394
    +        -> [OsString]     -- Suffix prefixes      e.g. ["x_", "y_"]
    
    395
    +        -> [OsPath]   -- Zapped filenames     e.g. ["foo.x_o", "foo.y_o"]
    
    394 396
             -- Note that the extra bit gets inserted *before* the old suffix
    
    395 397
             -- We assume the old suffix contains no dots, so we know where to
    
    396 398
             -- split it
    
    397 399
     insertSuffixes file_name extras
    
    398
    -  = [ basename <.> (extra ++ suffix) | extra <- extras ]
    
    400
    +  = [ basename OS.<.> (extra `mappend` suffix) | extra <- extras ]
    
    399 401
       where
    
    400
    -    (basename, suffix) = case splitExtension file_name of
    
    402
    +    (basename, suffix) = case OS.splitExtension file_name of
    
    401 403
                              -- Drop the "." from the extension
    
    402
    -                         (b, s) -> (b, drop 1 s)
    
    404
    +                         (b, s) -> (b, OS.drop 1 s)
    
    403 405
     
    
    404 406
     
    
    405 407
     -----------------------------------------------------------------
    

  • compiler/GHC/Driver/MakeFile/JSON.hs
    ... ... @@ -31,7 +31,7 @@ import GHC.Unit
    31 31
     import GHC.Utils.Json
    
    32 32
     import GHC.Utils.Misc
    
    33 33
     import GHC.Utils.Outputable
    
    34
    -import System.FilePath (normalise)
    
    34
    +import GHC.Data.OsPath
    
    35 35
     
    
    36 36
     --------------------------------------------------------------------------------
    
    37 37
     -- Output helpers
    
    ... ... @@ -92,9 +92,9 @@ writeJsonOutput =
    92 92
     data DepNode =
    
    93 93
       DepNode {
    
    94 94
         dn_mod :: Module,
    
    95
    -    dn_src :: FilePath,
    
    96
    -    dn_obj :: FilePath,
    
    97
    -    dn_hi :: FilePath,
    
    95
    +    dn_src :: OsPath,
    
    96
    +    dn_obj :: OsPath,
    
    97
    +    dn_hi :: OsPath,
    
    98 98
         dn_boot :: IsBootInterface,
    
    99 99
         dn_options :: Set.Set String
    
    100 100
       }
    
    ... ... @@ -102,14 +102,14 @@ data DepNode =
    102 102
     data Dep =
    
    103 103
       DepHi {
    
    104 104
         dep_mod :: Module,
    
    105
    -    dep_path :: FilePath,
    
    105
    +    dep_path :: OsPath,
    
    106 106
         dep_unit :: Maybe UnitInfo,
    
    107 107
         dep_local :: Bool,
    
    108 108
         dep_boot :: IsBootInterface
    
    109 109
       }
    
    110 110
       |
    
    111 111
       DepCpp {
    
    112
    -    dep_path :: FilePath
    
    112
    +    dep_path :: OsPath
    
    113 113
       }
    
    114 114
     
    
    115 115
     --------------------------------------------------------------------------------
    
    ... ... @@ -125,10 +125,10 @@ instance Semigroup PackageDeps where
    125 125
     
    
    126 126
     data Deps =
    
    127 127
       Deps {
    
    128
    -    sources :: Set.Set FilePath,
    
    128
    +    sources :: Set.Set OsPath,
    
    129 129
         modules :: (Set.Set ModuleName, Set.Set ModuleName),
    
    130 130
         packages :: PackageDeps,
    
    131
    -    cpp :: Set.Set FilePath,
    
    131
    +    cpp :: Set.Set OsPath,
    
    132 132
         options :: Set.Set String,
    
    133 133
         preprocessor :: Maybe FilePath
    
    134 134
       }
    
    ... ... @@ -141,7 +141,7 @@ instance ToJson DepJSON where
    141 141
       json (DepJSON m) =
    
    142 142
         JSObject [
    
    143 143
           (moduleNameString target, JSObject [
    
    144
    -        ("sources", array sources normalise),
    
    144
    +        ("sources", array sources (unsafeDecodeUtf . normalise)),
    
    145 145
             ("modules", array (fst modules) moduleNameString),
    
    146 146
             ("modules-boot", array (snd modules) moduleNameString),
    
    147 147
             ("packages",
    
    ... ... @@ -150,7 +150,7 @@ instance ToJson DepJSON where
    150 150
                 ((name, unit_id, package_id), mods) <- Map.toList packages
    
    151 151
               ]
    
    152 152
             ),
    
    153
    -        ("cpp", array cpp id),
    
    153
    +        ("cpp", array cpp unsafeDecodeUtf),
    
    154 154
             ("options", array options id),
    
    155 155
             ("preprocessor", maybe JSNull JSString preprocessor)
    
    156 156
           ])
    

  • compiler/GHC/Driver/Pipeline/Execute.hs
    ... ... @@ -58,6 +58,7 @@ import GHC.Iface.Make
    58 58
     import GHC.Driver.Config.Parser
    
    59 59
     import GHC.Parser.Header
    
    60 60
     import GHC.Data.StringBuffer
    
    61
    +import GHC.Data.OsPath (unsafeEncodeUtf)
    
    61 62
     import GHC.Types.SourceError
    
    62 63
     import GHC.Unit.Finder
    
    63 64
     import Data.IORef
    
    ... ... @@ -772,7 +773,7 @@ mkOneShotModLocation :: PipeEnv -> DynFlags -> HscSource -> ModuleName -> IO Mod
    772 773
     mkOneShotModLocation pipe_env dflags src_flavour mod_name = do
    
    773 774
         let PipeEnv{ src_basename=basename,
    
    774 775
                  src_suffix=suff } = pipe_env
    
    775
    -    let location1 = mkHomeModLocation2 fopts mod_name basename suff
    
    776
    +    let location1 = mkHomeModLocation2 fopts mod_name (unsafeEncodeUtf basename) (unsafeEncodeUtf suff)
    
    776 777
     
    
    777 778
         -- Boot-ify it if necessary
    
    778 779
         let location2
    
    ... ... @@ -784,11 +785,11 @@ mkOneShotModLocation pipe_env dflags src_flavour mod_name = do
    784 785
         -- This can't be done in mkHomeModuleLocation because
    
    785 786
         -- it only applies to the module being compiles
    
    786 787
         let ohi = outputHi dflags
    
    787
    -        location3 | Just fn <- ohi = location2{ ml_hi_file = fn }
    
    788
    +        location3 | Just fn <- ohi = location2{ ml_hi_file_ospath = unsafeEncodeUtf  fn }
    
    788 789
                       | otherwise      = location2
    
    789 790
     
    
    790 791
         let dynohi = dynOutputHi dflags
    
    791
    -        location4 | Just fn <- dynohi = location3{ ml_dyn_hi_file = fn }
    
    792
    +        location4 | Just fn <- dynohi = location3{ ml_dyn_hi_file_ospath = unsafeEncodeUtf fn }
    
    792 793
                       | otherwise         = location3
    
    793 794
     
    
    794 795
         -- Take -o into account if present
    
    ... ... @@ -802,10 +803,10 @@ mkOneShotModLocation pipe_env dflags src_flavour mod_name = do
    802 803
             location5 | Just ofile <- expl_o_file
    
    803 804
                       , let dyn_ofile = fromMaybe (ofile -<.> dynObjectSuf_ dflags) expl_dyn_o_file
    
    804 805
                       , isNoLink (ghcLink dflags)
    
    805
    -                  = location4 { ml_obj_file = ofile
    
    806
    -                              , ml_dyn_obj_file = dyn_ofile }
    
    806
    +                  = location4 { ml_obj_file_ospath = unsafeEncodeUtf ofile
    
    807
    +                              , ml_dyn_obj_file_ospath = unsafeEncodeUtf dyn_ofile }
    
    807 808
                       | Just dyn_ofile <- expl_dyn_o_file
    
    808
    -                  = location4 { ml_dyn_obj_file = dyn_ofile }
    
    809
    +                  = location4 { ml_dyn_obj_file_ospath = unsafeEncodeUtf dyn_ofile }
    
    809 810
                       | otherwise = location4
    
    810 811
         return location5
    
    811 812
         where
    

  • compiler/GHC/Iface/Errors.hs
    ... ... @@ -14,6 +14,7 @@ import GHC.Utils.Panic.Plain
    14 14
     import GHC.Driver.DynFlags
    
    15 15
     import GHC.Driver.Env
    
    16 16
     import GHC.Data.Maybe
    
    17
    +import GHC.Data.OsPath
    
    17 18
     import GHC.Prelude
    
    18 19
     import GHC.Unit
    
    19 20
     import GHC.Unit.Env
    
    ... ... @@ -55,13 +56,13 @@ cantFindInstalledErr unit_state mhome_unit profile mod_name find_result
    55 56
                 InstalledNotFound files mb_pkg
    
    56 57
                     | Just pkg <- mb_pkg
    
    57 58
                     , notHomeUnitId mhome_unit pkg
    
    58
    -                -> not_found_in_package pkg files
    
    59
    +                -> not_found_in_package pkg $ fmap unsafeDecodeUtf files
    
    59 60
     
    
    60 61
                     | null files
    
    61 62
                     -> NotAModule
    
    62 63
     
    
    63 64
                     | otherwise
    
    64
    -                -> CouldntFindInFiles files
    
    65
    +                -> CouldntFindInFiles $ fmap unsafeDecodeUtf files
    
    65 66
     
    
    66 67
                 _ -> panic "cantFindInstalledErr"
    
    67 68
     
    

  • compiler/GHC/Unit/Finder.hs
    ... ... @@ -43,6 +43,9 @@ import GHC.Platform.Ways
    43 43
     
    
    44 44
     import GHC.Builtin.Names ( gHC_PRIM )
    
    45 45
     
    
    46
    +import GHC.Data.Maybe ( expectJust )
    
    47
    +import GHC.Data.OsPath
    
    48
    +
    
    46 49
     import GHC.Unit.Env
    
    47 50
     import GHC.Unit.Types
    
    48 51
     import GHC.Unit.Module
    
    ... ... @@ -50,7 +53,6 @@ import GHC.Unit.Home
    50 53
     import GHC.Unit.State
    
    51 54
     import GHC.Unit.Finder.Types
    
    52 55
     
    
    53
    -import GHC.Data.Maybe    ( expectJust )
    
    54 56
     import qualified GHC.Data.ShortText as ST
    
    55 57
     
    
    56 58
     import GHC.Utils.Misc
    
    ... ... @@ -62,8 +64,7 @@ import GHC.Types.PkgQual
    62 64
     
    
    63 65
     import GHC.Fingerprint
    
    64 66
     import Data.IORef
    
    65
    -import System.Directory
    
    66
    -import System.FilePath
    
    67
    +import System.Directory.OsPath
    
    67 68
     import Control.Monad
    
    68 69
     import Data.Time
    
    69 70
     import qualified Data.Map as M
    
    ... ... @@ -72,9 +73,10 @@ import GHC.Driver.Env
    72 73
     import GHC.Driver.Config.Finder
    
    73 74
     import GHC.Unit.Module.Graph (mgHomeModuleMap, ModuleNameHomeMap)
    
    74 75
     import qualified Data.Set as Set
    
    76
    +import qualified System.OsPath as OsPath
    
    75 77
     
    
    76
    -type FileExt = String   -- Filename extension
    
    77
    -type BaseName = String  -- Basename of file
    
    78
    +type FileExt = OsString -- Filename extension
    
    79
    +type BaseName = OsPath  -- Basename of file
    
    78 80
     
    
    79 81
     -- -----------------------------------------------------------------------------
    
    80 82
     -- The Finder
    
    ... ... @@ -327,7 +329,7 @@ findLookupResult fc fopts r = case r of
    327 329
             -- implicit locations from the instances
    
    328 330
             InstalledFound loc   _ -> return (Found loc m)
    
    329 331
             InstalledNoPackage   _ -> return (NoPackage (moduleUnit m))
    
    330
    -        InstalledNotFound fp _ -> return (NotFound{ fr_paths = fp, fr_pkg = Just (moduleUnit m)
    
    332
    +        InstalledNotFound fp _ -> return (NotFound{ fr_paths = fmap unsafeDecodeUtf fp, fr_pkg = Just (moduleUnit m)
    
    331 333
                                              , fr_pkgs_hidden = []
    
    332 334
                                              , fr_mods_hidden = []
    
    333 335
                                              , fr_unusables = []
    
    ... ... @@ -398,7 +400,7 @@ findHomeModule fc fopts home_unit mod_name = do
    398 400
         InstalledFound loc _ -> Found loc (mkHomeModule home_unit mod_name)
    
    399 401
         InstalledNoPackage _ -> NoPackage uid -- impossible
    
    400 402
         InstalledNotFound fps _ -> NotFound {
    
    401
    -        fr_paths = fps,
    
    403
    +        fr_paths = fmap unsafeDecodeUtf fps,
    
    402 404
             fr_pkg = Just uid,
    
    403 405
             fr_mods_hidden = [],
    
    404 406
             fr_pkgs_hidden = [],
    
    ... ... @@ -423,7 +425,7 @@ findHomePackageModule fc fopts home_unit mod_name = do
    423 425
         InstalledFound loc _ -> Found loc (mkModule uid mod_name)
    
    424 426
         InstalledNoPackage _ -> NoPackage uid -- impossible
    
    425 427
         InstalledNotFound fps _ -> NotFound {
    
    426
    -        fr_paths = fps,
    
    428
    +        fr_paths = fmap unsafeDecodeUtf fps,
    
    427 429
             fr_pkg = Just uid,
    
    428 430
             fr_mods_hidden = [],
    
    429 431
             fr_pkgs_hidden = [],
    
    ... ... @@ -459,17 +461,17 @@ findInstalledHomeModule fc fopts home_unit mod_name = do
    459 461
          hi_dir_path =
    
    460 462
           case finder_hiDir fopts of
    
    461 463
             Just hiDir -> case maybe_working_dir of
    
    462
    -                        Nothing -> [hiDir]
    
    463
    -                        Just fp -> [fp </> hiDir]
    
    464
    +          Nothing -> [hiDir]
    
    465
    +          Just fp -> [fp </> hiDir]
    
    464 466
             Nothing -> home_path
    
    465 467
          hisuf = finder_hiSuf fopts
    
    466 468
          mod = mkModule home_unit mod_name
    
    467 469
     
    
    468 470
          source_exts =
    
    469
    -      [ ("hs",    mkHomeModLocationSearched fopts mod_name "hs")
    
    470
    -      , ("lhs",   mkHomeModLocationSearched fopts mod_name "lhs")
    
    471
    -      , ("hsig",  mkHomeModLocationSearched fopts mod_name "hsig")
    
    472
    -      , ("lhsig", mkHomeModLocationSearched fopts mod_name "lhsig")
    
    471
    +      [ (os "hs",    mkHomeModLocationSearched fopts mod_name $ os "hs")
    
    472
    +      , (os "lhs",   mkHomeModLocationSearched fopts mod_name $ os "lhs")
    
    473
    +      , (os "hsig",  mkHomeModLocationSearched fopts mod_name $ os "hsig")
    
    474
    +      , (os "lhsig", mkHomeModLocationSearched fopts mod_name $ os "lhsig")
    
    473 475
           ]
    
    474 476
     
    
    475 477
          -- we use mkHomeModHiOnlyLocation instead of mkHiOnlyModLocation so that
    
    ... ... @@ -494,10 +496,11 @@ findInstalledHomeModule fc fopts home_unit mod_name = do
    494 496
              else searchPathExts search_dirs mod exts
    
    495 497
     
    
    496 498
     -- | Prepend the working directory to the search path.
    
    497
    -augmentImports :: FilePath -> [FilePath] -> [FilePath]
    
    499
    +augmentImports :: OsPath -> [OsPath] -> [OsPath]
    
    498 500
     augmentImports _work_dir [] = []
    
    499
    -augmentImports work_dir (fp:fps) | isAbsolute fp = fp : augmentImports work_dir fps
    
    500
    -                                 | otherwise     = (work_dir </> fp) : augmentImports work_dir fps
    
    501
    +augmentImports work_dir (fp:fps)
    
    502
    +  | OsPath.isAbsolute fp = fp : augmentImports work_dir fps
    
    503
    +  | otherwise            = (work_dir </> fp) : augmentImports work_dir fps
    
    501 504
     
    
    502 505
     -- | Search for a module in external packages only.
    
    503 506
     findPackageModule :: FinderCache -> UnitState -> FinderOpts -> InstalledModule -> IO InstalledFindResult
    
    ... ... @@ -529,14 +532,14 @@ findPackageModule_ fc fopts mod pkg_conf = do
    529 532
            tag = waysBuildTag (finder_ways fopts)
    
    530 533
     
    
    531 534
                  -- hi-suffix for packages depends on the build tag.
    
    532
    -       package_hisuf | null tag  = "hi"
    
    533
    -                     | otherwise = tag ++ "_hi"
    
    535
    +       package_hisuf | null tag  = os "hi"
    
    536
    +                     | otherwise = os (tag ++ "_hi")
    
    534 537
     
    
    535
    -       package_dynhisuf = waysBuildTag (addWay WayDyn (finder_ways fopts)) ++ "_hi"
    
    538
    +       package_dynhisuf = os $ waysBuildTag (addWay WayDyn (finder_ways fopts)) ++ "_hi"
    
    536 539
     
    
    537 540
            mk_hi_loc = mkHiOnlyModLocation fopts package_hisuf package_dynhisuf
    
    538 541
     
    
    539
    -       import_dirs = map ST.unpack $ unitImportDirs pkg_conf
    
    542
    +       import_dirs = map (unsafeEncodeUtf . ST.unpack) $ unitImportDirs pkg_conf
    
    540 543
             -- we never look for a .hi-boot file in an external package;
    
    541 544
             -- .hi-boot files only make sense for the home package.
    
    542 545
         in
    
    ... ... @@ -544,7 +547,7 @@ findPackageModule_ fc fopts mod pkg_conf = do
    544 547
           [one] | finder_bypassHiFileCheck fopts ->
    
    545 548
                 -- there's only one place that this .hi file can be, so
    
    546 549
                 -- don't bother looking for it.
    
    547
    -            let basename = moduleNameSlashes (moduleName mod)
    
    550
    +            let basename = unsafeEncodeUtf $ moduleNameSlashes (moduleName mod)
    
    548 551
                     loc = mk_hi_loc one basename
    
    549 552
                 in return $ InstalledFound loc mod
    
    550 553
           _otherwise ->
    
    ... ... @@ -553,24 +556,24 @@ findPackageModule_ fc fopts mod pkg_conf = do
    553 556
     -- -----------------------------------------------------------------------------
    
    554 557
     -- General path searching
    
    555 558
     
    
    556
    -searchPathExts :: [FilePath]      -- paths to search
    
    559
    +searchPathExts :: [OsPath]        -- paths to search
    
    557 560
                    -> InstalledModule -- module name
    
    558 561
                    -> [ (
    
    559
    -                     FileExt,                             -- suffix
    
    560
    -                     FilePath -> BaseName -> ModLocation  -- action
    
    562
    +                     FileExt,                           -- suffix
    
    563
    +                     OsPath -> BaseName -> ModLocation  -- action
    
    561 564
                         )
    
    562 565
                       ]
    
    563 566
                    -> IO InstalledFindResult
    
    564 567
     
    
    565 568
     searchPathExts paths mod exts = search to_search
    
    566 569
       where
    
    567
    -    basename = moduleNameSlashes (moduleName mod)
    
    570
    +    basename = unsafeEncodeUtf $ moduleNameSlashes (moduleName mod)
    
    568 571
     
    
    569
    -    to_search :: [(FilePath, ModLocation)]
    
    572
    +    to_search :: [(OsPath, ModLocation)]
    
    570 573
         to_search = [ (file, fn path basename)
    
    571 574
                     | path <- paths,
    
    572 575
                       (ext,fn) <- exts,
    
    573
    -                  let base | path == "." = basename
    
    576
    +                  let base | path == os "." = basename
    
    574 577
                                | otherwise   = path </> basename
    
    575 578
                           file = base <.> ext
    
    576 579
                     ]
    
    ... ... @@ -584,7 +587,7 @@ searchPathExts paths mod exts = search to_search
    584 587
             else search rest
    
    585 588
     
    
    586 589
     mkHomeModLocationSearched :: FinderOpts -> ModuleName -> FileExt
    
    587
    -                          -> FilePath -> BaseName -> ModLocation
    
    590
    +                          -> OsPath -> BaseName -> ModLocation
    
    588 591
     mkHomeModLocationSearched fopts mod suff path basename =
    
    589 592
       mkHomeModLocation2 fopts mod (path </> basename) suff
    
    590 593
     
    
    ... ... @@ -622,18 +625,18 @@ mkHomeModLocationSearched fopts mod suff path basename =
    622 625
     -- ext
    
    623 626
     --      The filename extension of the source file (usually "hs" or "lhs").
    
    624 627
     
    
    625
    -mkHomeModLocation :: FinderOpts -> ModuleName -> FilePath -> ModLocation
    
    628
    +mkHomeModLocation :: FinderOpts -> ModuleName -> OsPath -> ModLocation
    
    626 629
     mkHomeModLocation dflags mod src_filename =
    
    627
    -   let (basename,extension) = splitExtension src_filename
    
    630
    +   let (basename,extension) = OsPath.splitExtension src_filename
    
    628 631
        in mkHomeModLocation2 dflags mod basename extension
    
    629 632
     
    
    630 633
     mkHomeModLocation2 :: FinderOpts
    
    631 634
                        -> ModuleName
    
    632
    -                   -> FilePath  -- Of source module, without suffix
    
    633
    -                   -> String    -- Suffix
    
    635
    +                   -> OsPath  -- Of source module, without suffix
    
    636
    +                   -> FileExt    -- Suffix
    
    634 637
                        -> ModLocation
    
    635 638
     mkHomeModLocation2 fopts mod src_basename ext =
    
    636
    -   let mod_basename = moduleNameSlashes mod
    
    639
    +   let mod_basename = unsafeEncodeUtf $ moduleNameSlashes mod
    
    637 640
     
    
    638 641
            obj_fn = mkObjPath  fopts src_basename mod_basename
    
    639 642
            dyn_obj_fn = mkDynObjPath  fopts src_basename mod_basename
    
    ... ... @@ -641,51 +644,51 @@ mkHomeModLocation2 fopts mod src_basename ext =
    641 644
            dyn_hi_fn  = mkDynHiPath   fopts src_basename mod_basename
    
    642 645
            hie_fn = mkHiePath  fopts src_basename mod_basename
    
    643 646
     
    
    644
    -   in (ModLocation{ ml_hs_file   = Just (src_basename <.> ext),
    
    645
    -                        ml_hi_file   = hi_fn,
    
    646
    -                        ml_dyn_hi_file = dyn_hi_fn,
    
    647
    -                        ml_obj_file  = obj_fn,
    
    648
    -                        ml_dyn_obj_file = dyn_obj_fn,
    
    649
    -                        ml_hie_file  = hie_fn })
    
    647
    +   in (OsPathModLocation{ ml_hs_file_ospath   = Just (src_basename <.> ext),
    
    648
    +                          ml_hi_file_ospath   = hi_fn,
    
    649
    +                          ml_dyn_hi_file_ospath = dyn_hi_fn,
    
    650
    +                          ml_obj_file_ospath  = obj_fn,
    
    651
    +                          ml_dyn_obj_file_ospath = dyn_obj_fn,
    
    652
    +                          ml_hie_file_ospath  = hie_fn })
    
    650 653
     
    
    651 654
     mkHomeModHiOnlyLocation :: FinderOpts
    
    652 655
                             -> ModuleName
    
    653
    -                        -> FilePath
    
    656
    +                        -> OsPath
    
    654 657
                             -> BaseName
    
    655 658
                             -> ModLocation
    
    656 659
     mkHomeModHiOnlyLocation fopts mod path basename =
    
    657
    -   let loc = mkHomeModLocation2 fopts mod (path </> basename) ""
    
    658
    -   in loc { ml_hs_file = Nothing }
    
    660
    +   let loc = mkHomeModLocation2 fopts mod (path </> basename) mempty
    
    661
    +   in loc { ml_hs_file_ospath = Nothing }
    
    659 662
     
    
    660 663
     -- This function is used to make a ModLocation for a package module. Hence why
    
    661 664
     -- we explicitly pass in the interface file suffixes.
    
    662
    -mkHiOnlyModLocation :: FinderOpts -> Suffix -> Suffix -> FilePath -> String
    
    665
    +mkHiOnlyModLocation :: FinderOpts -> FileExt -> FileExt -> OsPath -> OsPath
    
    663 666
                         -> ModLocation
    
    664 667
     mkHiOnlyModLocation fopts hisuf dynhisuf path basename
    
    665 668
      = let full_basename = path </> basename
    
    666 669
            obj_fn = mkObjPath fopts full_basename basename
    
    667 670
            dyn_obj_fn = mkDynObjPath fopts full_basename basename
    
    668 671
            hie_fn = mkHiePath fopts full_basename basename
    
    669
    -   in ModLocation{    ml_hs_file   = Nothing,
    
    670
    -                             ml_hi_file   = full_basename <.> hisuf,
    
    671
    -                                -- Remove the .hi-boot suffix from
    
    672
    -                                -- hi_file, if it had one.  We always
    
    673
    -                                -- want the name of the real .hi file
    
    674
    -                                -- in the ml_hi_file field.
    
    675
    -                             ml_dyn_obj_file = dyn_obj_fn,
    
    676
    -                             -- MP: TODO
    
    677
    -                             ml_dyn_hi_file  = full_basename <.> dynhisuf,
    
    678
    -                             ml_obj_file  = obj_fn,
    
    679
    -                             ml_hie_file  = hie_fn
    
    672
    +   in OsPathModLocation{  ml_hs_file_ospath   = Nothing,
    
    673
    +                          ml_hi_file_ospath   = full_basename <.> hisuf,
    
    674
    +                              -- Remove the .hi-boot suffix from
    
    675
    +                              -- hi_file, if it had one.  We always
    
    676
    +                              -- want the name of the real .hi file
    
    677
    +                              -- in the ml_hi_file field.
    
    678
    +                          ml_dyn_obj_file_ospath = dyn_obj_fn,
    
    679
    +                          -- MP: TODO
    
    680
    +                          ml_dyn_hi_file_ospath  = full_basename <.> dynhisuf,
    
    681
    +                          ml_obj_file_ospath  = obj_fn,
    
    682
    +                          ml_hie_file_ospath  = hie_fn
    
    680 683
                       }
    
    681 684
     
    
    682 685
     -- | Constructs the filename of a .o file for a given source file.
    
    683 686
     -- Does /not/ check whether the .o file exists
    
    684 687
     mkObjPath
    
    685 688
       :: FinderOpts
    
    686
    -  -> FilePath           -- the filename of the source file, minus the extension
    
    687
    -  -> String             -- the module name with dots replaced by slashes
    
    688
    -  -> FilePath
    
    689
    +  -> OsPath             -- the filename of the source file, minus the extension
    
    690
    +  -> OsPath             -- the module name with dots replaced by slashes
    
    691
    +  -> OsPath
    
    689 692
     mkObjPath fopts basename mod_basename = obj_basename <.> osuf
    
    690 693
       where
    
    691 694
                     odir = finder_objectDir fopts
    
    ... ... @@ -698,9 +701,9 @@ mkObjPath fopts basename mod_basename = obj_basename <.> osuf
    698 701
     -- Does /not/ check whether the .dyn_o file exists
    
    699 702
     mkDynObjPath
    
    700 703
       :: FinderOpts
    
    701
    -  -> FilePath           -- the filename of the source file, minus the extension
    
    702
    -  -> String             -- the module name with dots replaced by slashes
    
    703
    -  -> FilePath
    
    704
    +  -> OsPath             -- the filename of the source file, minus the extension
    
    705
    +  -> OsPath             -- the module name with dots replaced by slashes
    
    706
    +  -> OsPath
    
    704 707
     mkDynObjPath fopts basename mod_basename = obj_basename <.> dynosuf
    
    705 708
       where
    
    706 709
                     odir = finder_objectDir fopts
    
    ... ... @@ -714,9 +717,9 @@ mkDynObjPath fopts basename mod_basename = obj_basename <.> dynosuf
    714 717
     -- Does /not/ check whether the .hi file exists
    
    715 718
     mkHiPath
    
    716 719
       :: FinderOpts
    
    717
    -  -> FilePath           -- the filename of the source file, minus the extension
    
    718
    -  -> String             -- the module name with dots replaced by slashes
    
    719
    -  -> FilePath
    
    720
    +  -> OsPath             -- the filename of the source file, minus the extension
    
    721
    +  -> OsPath             -- the module name with dots replaced by slashes
    
    722
    +  -> OsPath
    
    720 723
     mkHiPath fopts basename mod_basename = hi_basename <.> hisuf
    
    721 724
      where
    
    722 725
                     hidir = finder_hiDir fopts
    
    ... ... @@ -729,9 +732,9 @@ mkHiPath fopts basename mod_basename = hi_basename <.> hisuf
    729 732
     -- Does /not/ check whether the .dyn_hi file exists
    
    730 733
     mkDynHiPath
    
    731 734
       :: FinderOpts
    
    732
    -  -> FilePath           -- the filename of the source file, minus the extension
    
    733
    -  -> String             -- the module name with dots replaced by slashes
    
    734
    -  -> FilePath
    
    735
    +  -> OsPath             -- the filename of the source file, minus the extension
    
    736
    +  -> OsPath             -- the module name with dots replaced by slashes
    
    737
    +  -> OsPath
    
    735 738
     mkDynHiPath fopts basename mod_basename = hi_basename <.> dynhisuf
    
    736 739
      where
    
    737 740
                     hidir = finder_hiDir fopts
    
    ... ... @@ -744,9 +747,9 @@ mkDynHiPath fopts basename mod_basename = hi_basename <.> dynhisuf
    744 747
     -- Does /not/ check whether the .hie file exists
    
    745 748
     mkHiePath
    
    746 749
       :: FinderOpts
    
    747
    -  -> FilePath           -- the filename of the source file, minus the extension
    
    748
    -  -> String             -- the module name with dots replaced by slashes
    
    749
    -  -> FilePath
    
    750
    +  -> OsPath             -- the filename of the source file, minus the extension
    
    751
    +  -> OsPath             -- the module name with dots replaced by slashes
    
    752
    +  -> OsPath
    
    750 753
     mkHiePath fopts basename mod_basename = hie_basename <.> hiesuf
    
    751 754
      where
    
    752 755
                     hiedir = finder_hieDir fopts
    
    ... ... @@ -767,23 +770,23 @@ mkStubPaths
    767 770
       :: FinderOpts
    
    768 771
       -> ModuleName
    
    769 772
       -> ModLocation
    
    770
    -  -> FilePath
    
    773
    +  -> OsPath
    
    771 774
     
    
    772 775
     mkStubPaths fopts mod location
    
    773 776
       = let
    
    774 777
             stubdir = finder_stubDir fopts
    
    775 778
     
    
    776
    -        mod_basename = moduleNameSlashes mod
    
    777
    -        src_basename = dropExtension $ expectJust "mkStubPaths"
    
    778
    -                                                  (ml_hs_file location)
    
    779
    +        mod_basename = unsafeEncodeUtf $ moduleNameSlashes mod
    
    780
    +        src_basename = OsPath.dropExtension $ expectJust "mkStubPaths"
    
    781
    +                                                  (ml_hs_file_ospath location)
    
    779 782
     
    
    780 783
             stub_basename0
    
    781 784
                 | Just dir <- stubdir = dir </> mod_basename
    
    782 785
                 | otherwise           = src_basename
    
    783 786
     
    
    784
    -        stub_basename = stub_basename0 ++ "_stub"
    
    787
    +        stub_basename = stub_basename0 `mappend` os "_stub"
    
    785 788
          in
    
    786
    -        stub_basename <.> "h"
    
    789
    +        stub_basename <.> os "h"
    
    787 790
     
    
    788 791
     -- -----------------------------------------------------------------------------
    
    789 792
     -- findObjectLinkable isn't related to the other stuff in here,
    

  • compiler/GHC/Unit/Finder/Types.hs
    ... ... @@ -9,6 +9,7 @@ where
    9 9
     
    
    10 10
     import GHC.Prelude
    
    11 11
     import GHC.Unit
    
    12
    +import GHC.Data.OsPath
    
    12 13
     import qualified Data.Map as M
    
    13 14
     import GHC.Fingerprint
    
    14 15
     import GHC.Platform.Ways
    
    ... ... @@ -31,7 +32,7 @@ data FinderCache = FinderCache { fcModuleCache :: (IORef FinderCacheState)
    31 32
     data InstalledFindResult
    
    32 33
       = InstalledFound ModLocation InstalledModule
    
    33 34
       | InstalledNoPackage UnitId
    
    34
    -  | InstalledNotFound [FilePath] (Maybe UnitId)
    
    35
    +  | InstalledNotFound [OsPath] (Maybe UnitId)
    
    35 36
     
    
    36 37
     -- | The result of searching for an imported module.
    
    37 38
     --
    
    ... ... @@ -70,7 +71,7 @@ data FindResult
    70 71
     --
    
    71 72
     -- Should be taken from 'DynFlags' via 'initFinderOpts'.
    
    72 73
     data FinderOpts = FinderOpts
    
    73
    -  { finder_importPaths :: [FilePath]
    
    74
    +  { finder_importPaths :: [OsPath]
    
    74 75
           -- ^ Where are we allowed to look for Modules and Source files
    
    75 76
       , finder_lookupHomeInterfaces :: Bool
    
    76 77
           -- ^ When looking up a home module:
    
    ... ... @@ -88,17 +89,17 @@ data FinderOpts = FinderOpts
    88 89
       , finder_enableSuggestions :: Bool
    
    89 90
           -- ^ If we encounter unknown modules, should we suggest modules
    
    90 91
           -- that have a similar name.
    
    91
    -  , finder_workingDirectory :: Maybe FilePath
    
    92
    +  , finder_workingDirectory :: Maybe OsPath
    
    92 93
       , finder_thisPackageName  :: Maybe FastString
    
    93 94
       , finder_hiddenModules    :: Set.Set ModuleName
    
    94 95
       , finder_reexportedModules :: Set.Set ModuleName
    
    95
    -  , finder_hieDir :: Maybe FilePath
    
    96
    -  , finder_hieSuf :: String
    
    97
    -  , finder_hiDir :: Maybe FilePath
    
    98
    -  , finder_hiSuf :: String
    
    99
    -  , finder_dynHiSuf :: String
    
    100
    -  , finder_objectDir :: Maybe FilePath
    
    101
    -  , finder_objectSuf :: String
    
    102
    -  , finder_dynObjectSuf :: String
    
    103
    -  , finder_stubDir :: Maybe FilePath
    
    96
    +  , finder_hieDir :: Maybe OsPath
    
    97
    +  , finder_hieSuf :: OsString
    
    98
    +  , finder_hiDir :: Maybe OsPath
    
    99
    +  , finder_hiSuf :: OsString
    
    100
    +  , finder_dynHiSuf :: OsString
    
    101
    +  , finder_objectDir :: Maybe OsPath
    
    102
    +  , finder_objectSuf :: OsString
    
    103
    +  , finder_dynObjectSuf :: OsString
    
    104
    +  , finder_stubDir :: Maybe OsPath
    
    104 105
       } deriving Show

  • compiler/GHC/Unit/Module/Location.hs
    1
    +{-# LANGUAGE PatternSynonyms #-}
    
    2
    +{-# LANGUAGE ViewPatterns #-}
    
    1 3
     -- | Module location
    
    2 4
     module GHC.Unit.Module.Location
    
    3
    -   ( ModLocation(..)
    
    5
    +   ( ModLocation
    
    6
    +    ( ..
    
    7
    +    , ml_hs_file
    
    8
    +    , ml_hi_file
    
    9
    +    , ml_dyn_hi_file
    
    10
    +    , ml_obj_file
    
    11
    +    , ml_dyn_obj_file
    
    12
    +    , ml_hie_file
    
    13
    +    )
    
    14
    +   , pattern ModLocation
    
    4 15
        , addBootSuffix
    
    5 16
        , addBootSuffix_maybe
    
    6 17
        , addBootSuffixLocn_maybe
    
    ... ... @@ -11,15 +22,19 @@ module GHC.Unit.Module.Location
    11 22
     where
    
    12 23
     
    
    13 24
     import GHC.Prelude
    
    25
    +
    
    26
    +import GHC.Data.OsPath
    
    14 27
     import GHC.Unit.Types
    
    15 28
     import GHC.Utils.Outputable
    
    16 29
     
    
    30
    +import qualified System.OsString as OsString
    
    31
    +
    
    17 32
     -- | Module Location
    
    18 33
     --
    
    19 34
     -- Where a module lives on the file system: the actual locations
    
    20 35
     -- of the .hs, .hi, .dyn_hi, .o, .dyn_o and .hie files, if we have them.
    
    21 36
     --
    
    22
    --- For a module in another unit, the ml_hs_file and ml_obj_file components of
    
    37
    +-- For a module in another unit, the ml_hs_file_ospath and ml_obj_file_ospath components of
    
    23 38
     -- ModLocation are undefined.
    
    24 39
     --
    
    25 40
     -- The locations specified by a ModLocation may or may not
    
    ... ... @@ -38,31 +53,31 @@ import GHC.Utils.Outputable
    38 53
     -- boot suffixes in mkOneShotModLocation.
    
    39 54
     
    
    40 55
     data ModLocation
    
    41
    -   = ModLocation {
    
    42
    -        ml_hs_file   :: Maybe FilePath,
    
    56
    +   = OsPathModLocation {
    
    57
    +        ml_hs_file_ospath   :: Maybe OsPath,
    
    43 58
                     -- ^ The source file, if we have one.  Package modules
    
    44 59
                     -- probably don't have source files.
    
    45 60
     
    
    46
    -        ml_hi_file   :: FilePath,
    
    61
    +        ml_hi_file_ospath   :: OsPath,
    
    47 62
                     -- ^ Where the .hi file is, whether or not it exists
    
    48 63
                     -- yet.  Always of form foo.hi, even if there is an
    
    49 64
                     -- hi-boot file (we add the -boot suffix later)
    
    50 65
     
    
    51
    -        ml_dyn_hi_file :: FilePath,
    
    66
    +        ml_dyn_hi_file_ospath :: OsPath,
    
    52 67
                     -- ^ Where the .dyn_hi file is, whether or not it exists
    
    53 68
                     -- yet.
    
    54 69
     
    
    55
    -        ml_obj_file  :: FilePath,
    
    70
    +        ml_obj_file_ospath  :: OsPath,
    
    56 71
                     -- ^ Where the .o file is, whether or not it exists yet.
    
    57 72
                     -- (might not exist either because the module hasn't
    
    58 73
                     -- been compiled yet, or because it is part of a
    
    59 74
                     -- unit with a .a file)
    
    60 75
     
    
    61
    -        ml_dyn_obj_file :: FilePath,
    
    76
    +        ml_dyn_obj_file_ospath :: OsPath,
    
    62 77
                     -- ^ Where the .dy file is, whether or not it exists
    
    63 78
                     -- yet.
    
    64 79
     
    
    65
    -        ml_hie_file  :: FilePath
    
    80
    +        ml_hie_file_ospath  :: OsPath
    
    66 81
                     -- ^ Where the .hie file is, whether or not it exists
    
    67 82
                     -- yet.
    
    68 83
       } deriving Show
    
    ... ... @@ -71,18 +86,18 @@ instance Outputable ModLocation where
    71 86
        ppr = text . show
    
    72 87
     
    
    73 88
     -- | Add the @-boot@ suffix to .hs, .hi and .o files
    
    74
    -addBootSuffix :: FilePath -> FilePath
    
    75
    -addBootSuffix path = path ++ "-boot"
    
    89
    +addBootSuffix :: OsPath -> OsPath
    
    90
    +addBootSuffix path = path `mappend` os "-boot"
    
    76 91
     
    
    77 92
     -- | Remove the @-boot@ suffix to .hs, .hi and .o files
    
    78
    -removeBootSuffix :: FilePath -> FilePath
    
    79
    -removeBootSuffix "-boot" = []
    
    80
    -removeBootSuffix (x:xs)  = x : removeBootSuffix xs
    
    81
    -removeBootSuffix []      = error "removeBootSuffix: no -boot suffix"
    
    82
    -
    
    93
    +removeBootSuffix :: OsPath -> OsPath
    
    94
    +removeBootSuffix pathWithBootSuffix =
    
    95
    +  case OsString.stripSuffix (os "-boot") pathWithBootSuffix of
    
    96
    +    Just path -> path
    
    97
    +    Nothing -> error "removeBootSuffix: no -boot suffix"
    
    83 98
     
    
    84 99
     -- | Add the @-boot@ suffix if the @Bool@ argument is @True@
    
    85
    -addBootSuffix_maybe :: IsBootInterface -> FilePath -> FilePath
    
    100
    +addBootSuffix_maybe :: IsBootInterface -> OsPath -> OsPath
    
    86 101
     addBootSuffix_maybe is_boot path = case is_boot of
    
    87 102
       IsBoot -> addBootSuffix path
    
    88 103
       NotBoot -> path
    
    ... ... @@ -95,22 +110,50 @@ addBootSuffixLocn_maybe is_boot locn = case is_boot of
    95 110
     -- | Add the @-boot@ suffix to all file paths associated with the module
    
    96 111
     addBootSuffixLocn :: ModLocation -> ModLocation
    
    97 112
     addBootSuffixLocn locn
    
    98
    -  = locn { ml_hs_file  = fmap addBootSuffix (ml_hs_file locn)
    
    99
    -         , ml_hi_file  = addBootSuffix (ml_hi_file locn)
    
    100
    -         , ml_dyn_hi_file = addBootSuffix (ml_dyn_hi_file locn)
    
    101
    -         , ml_obj_file = addBootSuffix (ml_obj_file locn)
    
    102
    -         , ml_dyn_obj_file = addBootSuffix (ml_dyn_obj_file locn)
    
    103
    -         , ml_hie_file = addBootSuffix (ml_hie_file locn) }
    
    113
    +  = locn { ml_hs_file_ospath = fmap addBootSuffix (ml_hs_file_ospath locn)
    
    114
    +         , ml_hi_file_ospath  = addBootSuffix (ml_hi_file_ospath locn)
    
    115
    +         , ml_dyn_hi_file_ospath = addBootSuffix (ml_dyn_hi_file_ospath locn)
    
    116
    +         , ml_obj_file_ospath = addBootSuffix (ml_obj_file_ospath locn)
    
    117
    +         , ml_dyn_obj_file_ospath = addBootSuffix (ml_dyn_obj_file_ospath locn)
    
    118
    +         , ml_hie_file_ospath = addBootSuffix (ml_hie_file_ospath locn) }
    
    104 119
     
    
    105 120
     -- | Add the @-boot@ suffix to all output file paths associated with the
    
    106 121
     -- module, not including the input file itself
    
    107 122
     addBootSuffixLocnOut :: ModLocation -> ModLocation
    
    108 123
     addBootSuffixLocnOut locn
    
    109
    -  = locn { ml_hi_file  = addBootSuffix (ml_hi_file locn)
    
    110
    -         , ml_dyn_hi_file = addBootSuffix (ml_dyn_hi_file locn)
    
    111
    -         , ml_obj_file = addBootSuffix (ml_obj_file locn)
    
    112
    -         , ml_dyn_obj_file = addBootSuffix (ml_dyn_obj_file locn)
    
    113
    -         , ml_hie_file = addBootSuffix (ml_hie_file locn)
    
    124
    +  = locn { ml_hi_file_ospath = addBootSuffix (ml_hi_file_ospath locn)
    
    125
    +         , ml_dyn_hi_file_ospath = addBootSuffix (ml_dyn_hi_file_ospath locn)
    
    126
    +         , ml_obj_file_ospath = addBootSuffix (ml_obj_file_ospath locn)
    
    127
    +         , ml_dyn_obj_file_ospath = addBootSuffix (ml_dyn_obj_file_ospath locn)
    
    128
    +         , ml_hie_file_ospath = addBootSuffix (ml_hie_file_ospath locn)
    
    114 129
              }
    
    115 130
     
    
    116
    -
    131
    +-- ----------------------------------------------------------------------------
    
    132
    +-- Helpers for backwards compatibility
    
    133
    +-- ----------------------------------------------------------------------------
    
    134
    +
    
    135
    +pattern ModLocation :: Maybe FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> ModLocation
    
    136
    +pattern ModLocation
    
    137
    +  { ml_hs_file
    
    138
    +  , ml_hi_file
    
    139
    +  , ml_dyn_hi_file
    
    140
    +  , ml_obj_file
    
    141
    +  , ml_dyn_obj_file
    
    142
    +  , ml_hie_file
    
    143
    +  } <- OsPathModLocation
    
    144
    +    { ml_hs_file_ospath = (fmap unsafeDecodeUtf -> ml_hs_file)
    
    145
    +    , ml_hi_file_ospath = (unsafeDecodeUtf -> ml_hi_file)
    
    146
    +    , ml_dyn_hi_file_ospath = (unsafeDecodeUtf -> ml_dyn_hi_file)
    
    147
    +    , ml_obj_file_ospath = (unsafeDecodeUtf -> ml_obj_file)
    
    148
    +    , ml_dyn_obj_file_ospath = (unsafeDecodeUtf -> ml_dyn_obj_file)
    
    149
    +    , ml_hie_file_ospath = (unsafeDecodeUtf -> ml_hie_file)
    
    150
    +    } where
    
    151
    +      ModLocation ml_hs_file ml_hi_file ml_dyn_hi_file ml_obj_file ml_dyn_obj_file ml_hie_file
    
    152
    +        = OsPathModLocation
    
    153
    +          { ml_hs_file_ospath = fmap unsafeEncodeUtf ml_hs_file
    
    154
    +          , ml_hi_file_ospath = unsafeEncodeUtf ml_hi_file
    
    155
    +          , ml_dyn_hi_file_ospath = unsafeEncodeUtf ml_dyn_hi_file
    
    156
    +          , ml_obj_file_ospath = unsafeEncodeUtf ml_obj_file
    
    157
    +          , ml_dyn_obj_file_ospath = unsafeEncodeUtf ml_dyn_obj_file
    
    158
    +          , ml_hie_file_ospath = unsafeEncodeUtf ml_hie_file
    
    159
    +          }

  • compiler/GHC/Unit/Module/ModSummary.hs
    ... ... @@ -17,6 +17,11 @@ module GHC.Unit.Module.ModSummary
    17 17
        , msHsFilePath
    
    18 18
        , msObjFilePath
    
    19 19
        , msDynObjFilePath
    
    20
    +   , msHsFileOsPath
    
    21
    +   , msHiFileOsPath
    
    22
    +   , msDynHiFileOsPath
    
    23
    +   , msObjFileOsPath
    
    24
    +   , msDynObjFileOsPath
    
    20 25
        , msDeps
    
    21 26
        , isBootSummary
    
    22 27
        , findTarget
    
    ... ... @@ -38,6 +43,7 @@ import GHC.Types.Target
    38 43
     import GHC.Types.PkgQual
    
    39 44
     
    
    40 45
     import GHC.Data.Maybe
    
    46
    +import GHC.Data.OsPath (OsPath)
    
    41 47
     import GHC.Data.StringBuffer ( StringBuffer )
    
    42 48
     
    
    43 49
     import GHC.Utils.Fingerprint
    
    ... ... @@ -148,6 +154,13 @@ msDynHiFilePath ms = ml_dyn_hi_file (ms_location ms)
    148 154
     msObjFilePath ms = ml_obj_file (ms_location ms)
    
    149 155
     msDynObjFilePath ms = ml_dyn_obj_file (ms_location ms)
    
    150 156
     
    
    157
    +msHsFileOsPath, msDynHiFileOsPath, msHiFileOsPath, msObjFileOsPath, msDynObjFileOsPath :: ModSummary -> OsPath
    
    158
    +msHsFileOsPath  ms = expectJust "msHsFilePath" (ml_hs_file_ospath  (ms_location ms))
    
    159
    +msHiFileOsPath  ms = ml_hi_file_ospath  (ms_location ms)
    
    160
    +msDynHiFileOsPath ms = ml_dyn_hi_file_ospath (ms_location ms)
    
    161
    +msObjFileOsPath ms = ml_obj_file_ospath (ms_location ms)
    
    162
    +msDynObjFileOsPath ms = ml_dyn_obj_file_ospath (ms_location ms)
    
    163
    +
    
    151 164
     -- | Did this 'ModSummary' originate from a hs-boot file?
    
    152 165
     isBootSummary :: ModSummary -> IsBootInterface
    
    153 166
     isBootSummary ms = if ms_hsc_src ms == HsBootFile then IsBoot else NotBoot
    

  • compiler/ghc.cabal.in
    ... ... @@ -117,6 +117,7 @@ Library
    117 117
                        filepath   >= 1   && < 1.6,
    
    118 118
                        os-string  >= 2.0.1 && < 2.1,
    
    119 119
                        template-haskell == 2.22.*,
    
    120
    +                   os-string  >= 2.0.1 && < 2.1,
    
    120 121
                        hpc        >= 0.6 && < 0.8,
    
    121 122
                        transformers >= 0.5 && < 0.7,
    
    122 123
                        exceptions == 0.10.*,
    

  • ghc/ghc-bin.cabal.in
    ... ... @@ -36,7 +36,7 @@ Executable ghc
    36 36
                        bytestring >= 0.9 && < 0.13,
    
    37 37
                        directory  >= 1   && < 1.4,
    
    38 38
                        process    >= 1   && < 1.7,
    
    39
    -                   filepath   >= 1   && < 1.6,
    
    39
    +                   filepath   >= 1.5 && < 1.6,
    
    40 40
                        containers >= 0.5 && < 0.8,
    
    41 41
                        transformers >= 0.5 && < 0.7,
    
    42 42
                        ghc-boot      == @ProjectVersionMunged@,
    

  • testsuite/tests/count-deps/CountDepsAst.stdout
    ... ... @@ -70,6 +70,7 @@ GHC.Data.List.Infinite
    70 70
     GHC.Data.List.SetOps
    
    71 71
     GHC.Data.Maybe
    
    72 72
     GHC.Data.OrdList
    
    73
    +GHC.Data.OsPath
    
    73 74
     GHC.Data.Pair
    
    74 75
     GHC.Data.SmallArray
    
    75 76
     GHC.Data.Strict
    

  • testsuite/tests/count-deps/CountDepsParser.stdout
    ... ... @@ -71,6 +71,7 @@ GHC.Data.List.Infinite
    71 71
     GHC.Data.List.SetOps
    
    72 72
     GHC.Data.Maybe
    
    73 73
     GHC.Data.OrdList
    
    74
    +GHC.Data.OsPath
    
    74 75
     GHC.Data.Pair
    
    75 76
     GHC.Data.SmallArray
    
    76 77
     GHC.Data.Strict