@@ -66,7 +66,7 @@ import Development.IDE.Graph (Action)
6666import Development.IDE.Session.VersionCheck
6767import Development.IDE.Types.Diagnostics
6868import Development.IDE.Types.Exports
69- import Development.IDE.Types.HscEnvEq (HscEnvEq , newHscEnvEq , envImportPaths ,
69+ import Development.IDE.Types.HscEnvEq (HscEnvEq , newHscEnvEq ,
7070 newHscEnvEqPreserveImportPaths )
7171import Development.IDE.Types.Location
7272import Development.IDE.Types.Options
@@ -125,7 +125,6 @@ import GHC.Driver.Make (checkHomeUnitsClosed)
125125import GHC.Unit.State
126126import GHC.Types.Error (errMsgDiagnostic )
127127import GHC.Data.Bag
128- import GHC.Unit.Env
129128#endif
130129
131130import GHC.ResponseFile
@@ -518,17 +517,17 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} dir = do
518517 -- compilation but these are the true source of
519518 -- information.
520519 new_deps = fmap (\ (df, targets) -> RawComponentInfo (homeUnitId_ df) df targets cfp opts dep_info) newTargetDfs
521- all_deps = new_deps `appendListToNonEmpty ` maybe [] id oldDeps
520+ all_deps = new_deps `NE.appendList ` maybe [] id oldDeps
522521 -- Get all the unit-ids for things in this component
523- inplace = map rawComponentUnitId $ NE. toList all_deps
522+ _inplace = map rawComponentUnitId $ NE. toList all_deps
524523
525524 all_deps' <- forM all_deps $ \ RawComponentInfo {.. } -> do
526525 -- Remove all inplace dependencies from package flags for
527526 -- components in this HscEnv
528527#if MIN_VERSION_ghc(9,3,0)
529528 let (df2, uids) = (rawComponentDynFlags, [] )
530529#else
531- let (df2, uids) = _removeInplacePackages fakeUid inplace rawComponentDynFlags
530+ let (df2, uids) = _removeInplacePackages fakeUid _inplace rawComponentDynFlags
532531#endif
533532 let prefix = show rawComponentUnitId
534533 -- See Note [Avoiding bad interface files]
@@ -539,13 +538,15 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} dir = do
539538 -- The final component information, mostly the same but the DynFlags don't
540539 -- contain any packages which are also loaded
541540 -- into the same component.
542- pure $ ComponentInfo rawComponentUnitId
543- processed_df
544- uids
545- rawComponentTargets
546- rawComponentFP
547- rawComponentCOptions
548- rawComponentDependencyInfo
541+ pure $ ComponentInfo
542+ { componentUnitId = rawComponentUnitId
543+ , componentDynFlags = processed_df
544+ , componentInternalUnits = uids
545+ , componentTargets = rawComponentTargets
546+ , componentFP = rawComponentFP
547+ , componentCOptions = rawComponentCOptions
548+ , componentDependencyInfo = rawComponentDependencyInfo
549+ }
549550 -- Modify the map so the hieYaml now maps to the newly updated
550551 -- ComponentInfos
551552 -- Returns
@@ -968,13 +969,13 @@ data ComponentInfo = ComponentInfo
968969 -- | Internal units, such as local libraries, that this component
969970 -- is loaded with. These have been extracted from the original
970971 -- ComponentOptions.
971- , _componentInternalUnits :: [UnitId ]
972+ , componentInternalUnits :: [UnitId ]
972973 -- | All targets of this components.
973974 , componentTargets :: [GHC. Target ]
974975 -- | Filepath which caused the creation of this component
975976 , componentFP :: NormalizedFilePath
976977 -- | Component Options used to load the component.
977- , _componentCOptions :: ComponentOptions
978+ , componentCOptions :: ComponentOptions
978979 -- | Maps cradle dependencies, such as `stack.yaml`, or `.cabal` file
979980 -- to last modification time. See Note [Multi Cradle Dependency Info]
980981 , componentDependencyInfo :: DependencyInfo
@@ -1050,9 +1051,9 @@ addUnit unit_str = liftEwM $ do
10501051 putCmdLineState (unit_str : units)
10511052
10521053-- | Throws if package flags are unsatisfiable
1053- setOptions :: GhcMonad m => NormalizedFilePath -> ComponentOptions -> DynFlags -> m (NE. NonEmpty (DynFlags , [GHC. Target ]))
1054+ setOptions :: GhcMonad m => NormalizedFilePath -> ComponentOptions -> DynFlags -> m (NonEmpty (DynFlags , [GHC. Target ]))
10541055setOptions cfp (ComponentOptions theOpts compRoot _) dflags = do
1055- ((theOpts',errs,warns ),units) <- processCmdLineP unit_flags [] (map noLoc theOpts)
1056+ ((theOpts',_errs,_warns ),units) <- processCmdLineP unit_flags [] (map noLoc theOpts)
10561057 case NE. nonEmpty units of
10571058 Just us -> initMulti us
10581059 Nothing -> do
@@ -1071,14 +1072,14 @@ setOptions cfp (ComponentOptions theOpts compRoot _) dflags = do
10711072 -- does list all targets.
10721073 abs_fp <- liftIO $ makeAbsolute (fromNormalizedFilePath cfp)
10731074 let special_target = Compat. mkSimpleTarget df abs_fp
1074- pure $ (df, special_target : targets) NE. :| []
1075+ pure $ (df, special_target : targets) :| []
10751076 where
10761077 initMulti unitArgFiles =
10771078 forM unitArgFiles $ \ f -> do
10781079 args <- liftIO $ expandResponse [f]
10791080 initOne args
1080- initOne theOpts = do
1081- (dflags', targets') <- addCmdOpts theOpts dflags
1081+ initOne this_opts = do
1082+ (dflags', targets') <- addCmdOpts this_opts dflags
10821083 let dflags'' =
10831084#if MIN_VERSION_ghc(9,3,0)
10841085 case unitIdString (homeUnitId_ dflags') of
@@ -1089,7 +1090,7 @@ setOptions cfp (ComponentOptions theOpts compRoot _) dflags = do
10891090 -- This works because there won't be any dependencies on the
10901091 -- executable unit.
10911092 " main" ->
1092- let hash = B. unpack $ B16. encode $ H. finalize $ H. updates H. init (map B. pack $ theOpts )
1093+ let hash = B. unpack $ B16. encode $ H. finalize $ H. updates H. init (map B. pack $ this_opts )
10931094 hashed_uid = Compat. toUnitId (Compat. stringToUnit (" main-" ++ hash))
10941095 in setHomeUnitId_ hashed_uid dflags'
10951096 _ -> dflags'
@@ -1202,11 +1203,3 @@ showPackageSetupException (PackageCheckFailed BasePackageAbiMismatch{..}) = unwo
12021203renderPackageSetupException :: FilePath -> PackageSetupException -> (NormalizedFilePath , ShowDiagnostic , Diagnostic )
12031204renderPackageSetupException fp e =
12041205 ideErrorWithSource (Just " cradle" ) (Just DiagnosticSeverity_Error ) (toNormalizedFilePath' fp) (T. pack $ showPackageSetupException e)
1205-
1206-
1207- appendListToNonEmpty :: NE. NonEmpty a -> [a ] -> NE. NonEmpty a
1208- #if MIN_VERSION_base(4,16,0)
1209- appendListToNonEmpty = NE. appendList
1210- #else
1211- appendListToNonEmpty (x NE. :| xs) ys = x NE. :| (xs ++ ys)
1212- #endif
0 commit comments