Skip to content

Commit d330291

Browse files
committed
Remove hie-compat
While removing references to GHC 9.4, I realized that some parts of HLS are referring to even older versions of GHC. For example, `hie-compat` is a compatibility library backporting support of Haskell IDE Engine (HIE) features to older versions of GHC. Since GHC 9.2, `hie-compat` only re-exported definitions already present in the `ghc` library, and so, is essentially obsolete. FYI: We still have `hie-compat` in the dependency graph, because some libraries (e.g., `hiedb`) are using it.
1 parent d9aaa01 commit d330291

File tree

52 files changed

+127
-2533
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+127
-2533
lines changed

CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
/hls-graph @wz1000
55
/hls-plugin-api @michaelpj @fendor
66
/hls-test-utils @fendor
7-
/hie-compat @wz1000
87

98
# HLS main
109
/src @fendor

RELEASING.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
- [ ] bump package versions in all `*.cabal` files (same version as hls)
1010
- HLS uses lockstep versioning. The core packages and all plugins use the same version number, and only support exactly this version.
1111
- Exceptions:
12-
- `hie-compat` requires no automatic version bump.
1312
- `shake-bench` is an internal testing tool, not exposed to the outside world. Thus, no version bump required for releases.
1413
- For updating cabal files, the following script can be used:
1514
- ```sh

cabal.project

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
packages:
22
./
3-
./hie-compat
43
./shake-bench
54
./hls-graph
65
./ghcide

docs/contributing/contributing.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ pre-commit install
197197
#### Why are some components excluded from automatic formatting?
198198

199199
- `test/testdata` and `test/data` are excluded because we want to test formatting plugins.
200-
- `hie-compat` is excluded because we want to keep its code as close to GHC as possible.
201200

202201
## Plugin tutorial
203202

ghcide/ghcide.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ library
7474
, haddock-library >=1.8 && <1.12
7575
, hashable
7676
, hie-bios ^>=0.15.0
77-
, hie-compat ^>=0.3.0.0
7877
, hiedb ^>= 0.6.0.2
7978
, hls-graph == 2.11.0.0
8079
, hls-plugin-api == 2.11.0.0

ghcide/src/Development/IDE/Core/Actions.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import Development.IDE.Graph
2828
import qualified Development.IDE.Spans.AtPoint as AtPoint
2929
import Development.IDE.Types.HscEnvEq (hscEnv)
3030
import Development.IDE.Types.Location
31+
import GHC.Iface.Ext.Types (Identifier)
3132
import qualified HieDb
3233
import Language.LSP.Protocol.Types (DocumentHighlight (..),
3334
SymbolInformation (..),

ghcide/src/Development/IDE/Core/Compile.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ import qualified Data.Set as Set
109109
import qualified GHC as G
110110
import GHC.Core.Lint.Interactive
111111
import GHC.Driver.Config.CoreToStg.Prep
112+
import GHC.Iface.Ext.Types (HieASTs)
112113
import qualified GHC.Runtime.Loader as Loader
113114
import GHC.Tc.Gen.Splice
114115
import GHC.Types.Error
@@ -145,6 +146,7 @@ import Development.IDE.GHC.Compat hiding
145146
import qualified Data.List.NonEmpty as NE
146147
import Data.Time (getCurrentTime)
147148
import GHC.Driver.Env (hsc_all_home_unit_ids)
149+
import GHC.Iface.Ext.Types (NameEntityInfo)
148150
#endif
149151

150152
#if MIN_VERSION_ghc(9,12,0)

ghcide/src/Development/IDE/Core/RuleTypes.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ import Development.IDE.Import.DependencyInformation
3434
import Development.IDE.Types.HscEnvEq (HscEnvEq)
3535
import Development.IDE.Types.KnownTargets
3636
import GHC.Generics (Generic)
37+
import GHC.Iface.Ext.Types (HieASTs,
38+
TypeIndex)
39+
import GHC.Iface.Ext.Utils (RefMap)
3740

3841
import Data.ByteString (ByteString)
3942
import Data.Text.Utf16.Rope.Mixed (Rope)

ghcide/src/Development/IDE/Core/Rules.hs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ import Development.IDE.Types.HscEnvEq
138138
import Development.IDE.Types.Location
139139
import Development.IDE.Types.Options
140140
import qualified Development.IDE.Types.Shake as Shake
141+
import GHC.Iface.Ext.Types (HieASTs (..))
142+
import GHC.Iface.Ext.Utils (generateReferencesMap)
141143
import qualified GHC.LanguageExtensions as LangExt
142144
import HIE.Bios.Ghc.Gap (hostIsDynamic)
143145
import qualified HieDb
@@ -512,7 +514,7 @@ persistentHieFileRule recorder = addPersistentRule GetHieAst $ \file -> runMaybe
512514
(currentSource, ver) <- liftIO $ case M.lookup (filePathToUri' file) vfsData of
513515
Nothing -> (,Nothing) . T.decodeUtf8 <$> BS.readFile (fromNormalizedFilePath file)
514516
Just vf -> pure (virtualFileText vf, Just $ virtualFileVersion vf)
515-
let refmap = Compat.generateReferencesMap . Compat.getAsts . Compat.hie_asts $ res
517+
let refmap = generateReferencesMap . getAsts . Compat.hie_asts $ res
516518
del = deltaFromDiff (T.decodeUtf8 $ Compat.hie_hs_src res) currentSource
517519
pure (HAR (Compat.hie_module res) (Compat.hie_asts res) refmap mempty (HieFromDisk res),del,ver)
518520

@@ -540,8 +542,8 @@ getHieAstRuleDefinition f hsc tmr = do
540542
liftIO $ writeAndIndexHieFile hsc se modSummary f exports asts source
541543
_ -> pure []
542544

543-
let refmap = Compat.generateReferencesMap . Compat.getAsts <$> masts
544-
typemap = AtPoint.computeTypeReferences . Compat.getAsts <$> masts
545+
let refmap = generateReferencesMap . getAsts <$> masts
546+
typemap = AtPoint.computeTypeReferences . getAsts <$> masts
545547
pure (diags <> diagsWrite, HAR (ms_mod $ tmrModSummary tmr) <$> masts <*> refmap <*> typemap <*> pure HieFresh)
546548

547549
getImportMapRule :: Recorder (WithPriority Log) -> Rules ()

ghcide/src/Development/IDE/GHC/Compat.hs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ module Development.IDE.GHC.Compat(
4545
readHieFile,
4646
setHieDir,
4747
dontWriteHieFiles,
48-
module Compat.HieTypes,
49-
module Compat.HieUtils,
5048
-- * Compat modules
5149
module Development.IDE.GHC.Compat.Core,
5250
module Development.IDE.GHC.Compat.Env,
@@ -112,14 +110,8 @@ module Development.IDE.GHC.Compat(
112110
#if MIN_VERSION_ghc(9,7,0)
113111
tcInitTidyEnv,
114112
#endif
115-
) where
116113

117-
import Compat.HieAst (enrichHie)
118-
import Compat.HieBin
119-
import Compat.HieTypes hiding
120-
(nodeAnnotations)
121-
import qualified Compat.HieTypes as GHC (nodeAnnotations)
122-
import Compat.HieUtils
114+
) where
123115
import Control.Applicative ((<|>))
124116
import qualified Data.ByteString as BS
125117
import Data.Coerce (coerce)
@@ -146,12 +138,18 @@ import GHC.Core.Tidy (tidyExpr)
146138
import GHC.CoreToStg.Prep (corePrepPgm)
147139
import qualified GHC.CoreToStg.Prep as GHC
148140
import GHC.Driver.Hooks (hscCompileCoreExprHook)
141+
import GHC.Iface.Ext.Types hiding
142+
(nodeAnnotations)
143+
import qualified GHC.Iface.Ext.Types as GHC (nodeAnnotations)
144+
import GHC.Iface.Ext.Utils
149145

150146
import GHC.ByteCode.Asm (bcoFreeNames)
151147
import GHC.Core
152148
import GHC.Data.FastString
153149
import GHC.Data.StringBuffer
154150
import GHC.Driver.Session hiding (ExposePackage)
151+
import GHC.Iface.Ext.Ast (enrichHie)
152+
import GHC.Iface.Ext.Binary
155153
import GHC.Iface.Make (mkIfaceExports)
156154
import GHC.SysTools.Tasks (runPp, runUnlit)
157155
import GHC.Types.Annotations (AnnTarget (ModuleTarget),

ghcide/src/Development/IDE/GHC/CoreFile.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import Data.Foldable
1818
import Data.IORef
1919
import Data.List (isPrefixOf)
2020
import Data.Maybe
21-
import qualified Data.Text as T
2221
import Development.IDE.GHC.Compat
2322
import qualified Development.IDE.GHC.Compat.Util as Util
2423
import GHC.Core

ghcide/src/Development/IDE/GHC/Orphans.hs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
-- | Orphan instances for GHC.
88
-- Note that the 'NFData' instances may not be law abiding.
99
module Development.IDE.GHC.Orphans() where
10-
import Development.IDE.GHC.Compat hiding
11-
(DuplicateRecordFields,
12-
FieldSelectors)
10+
import Development.IDE.GHC.Compat
1311
import Development.IDE.GHC.Util
1412

1513
import Control.DeepSeq
@@ -24,9 +22,8 @@ import GHC.ByteCode.Types
2422
import GHC.Data.Bag
2523
import GHC.Data.FastString
2624
import qualified GHC.Data.StringBuffer as SB
25+
import GHC.Iface.Ext.Types
2726
import GHC.Parser.Annotation
28-
import GHC.Types.FieldLabel (DuplicateRecordFields (DuplicateRecordFields, NoDuplicateRecordFields),
29-
FieldSelectors (FieldSelectors, NoFieldSelectors))
3027
import GHC.Types.PkgQual
3128
import GHC.Types.SrcLoc
3229

ghcide/src/Development/IDE/Plugin/Completions/Logic.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ import Development.IDE.Plugin.Completions.Types
4949
import Development.IDE.Spans.LocalBindings
5050
import Development.IDE.Types.Exports
5151
import Development.IDE.Types.Options
52+
import GHC.Iface.Ext.Types (HieAST,
53+
NodeInfo (..))
54+
import GHC.Iface.Ext.Utils (nodeInfo)
5255
import Ide.PluginUtils (mkLspCommand)
5356
import Ide.Types (CommandId (..),
5457
IdePlugins (..),

ghcide/src/Development/IDE/Spans/AtPoint.hs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,23 @@ import Data.Tree
6767
import qualified Data.Tree as T
6868
import Data.Version (showVersion)
6969
import Development.IDE.Types.Shake (WithHieDb)
70+
import GHC.Iface.Ext.Types (EvVarSource (..),
71+
HieAST (..),
72+
HieASTs (..),
73+
HieArgs (..),
74+
HieType (..), Identifier,
75+
IdentifierDetails (..),
76+
NodeInfo (..), Scope,
77+
Span)
78+
import GHC.Iface.Ext.Utils (EvidenceInfo (..),
79+
RefMap, getEvidenceTree,
80+
getScopeFromContext,
81+
hieTypeToIface,
82+
isEvidenceContext,
83+
isEvidenceUse,
84+
isOccurrence, nodeInfo,
85+
recoverFullType,
86+
selectSmallestContaining)
7087
import HieDb hiding (pointCommand,
7188
withHieDb)
7289
import System.Directory (doesFileExist)
@@ -488,7 +505,7 @@ instanceLocationsAtPoint
488505
instanceLocationsAtPoint withHieDb lookupModule _ideOptions pos (HAR _ ast _rm _ _) =
489506
let ns = concat $ pointCommand ast pos (M.keys . getNodeIds)
490507
evTrees = mapMaybe (eitherToMaybe >=> getEvidenceTree _rm) ns
491-
evNs = concatMap (map (evidenceVar) . T.flatten) evTrees
508+
evNs = concatMap (map evidenceVar . T.flatten) evTrees
492509
in fmap (nubOrd . concat) $ mapMaybeM
493510
(nameToLocation withHieDb lookupModule)
494511
evNs

ghcide/src/Development/IDE/Spans/Documentation.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import Development.IDE.GHC.Compat.Util
2828
import Development.IDE.GHC.Error
2929
import Development.IDE.GHC.Util (printOutputable)
3030
import Development.IDE.Spans.Common
31+
import GHC.Iface.Ext.Utils (RefMap)
3132
import Language.LSP.Protocol.Types (filePathToUri, getUri)
3233
import Prelude hiding (mod)
3334
import System.Directory

ghcide/src/Development/IDE/Spans/LocalBindings.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@ import qualified Data.IntervalMap.FingerTree as IM
1717
import qualified Data.List as L
1818
import qualified Data.Map as M
1919
import qualified Data.Set as S
20+
import GHC.Iface.Ext.Types (IdentifierDetails (..),
21+
Scope (..))
22+
import GHC.Iface.Ext.Utils (RefMap, getBindSiteFromContext,
23+
getScopeFromContext)
24+
2025
import Development.IDE.GHC.Compat (Name, NameEnv, RealSrcSpan,
21-
RefMap, Scope (..), Type,
22-
getBindSiteFromContext,
23-
getScopeFromContext, identInfo,
24-
identType, isSystemName,
26+
Type, isSystemName,
2527
nonDetNameEnvElts,
2628
realSrcSpanEnd,
2729
realSrcSpanStart, unitNameEnv)
28-
2930
import Development.IDE.GHC.Error
3031
import Development.IDE.Types.Location
3132

haskell-language-server.cabal

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ library hls-call-hierarchy-plugin
406406
, aeson
407407
, containers
408408
, extra
409+
, ghc
409410
, ghcide == 2.11.0.0
410411
, hiedb ^>= 0.6.0.2
411412
, hls-plugin-api == 2.11.0.0
@@ -592,10 +593,10 @@ library hls-rename-plugin
592593
hs-source-dirs: plugins/hls-rename-plugin/src
593594
build-depends:
594595
, containers
596+
, ghc
595597
, ghcide == 2.11.0.0
596598
, hashable
597599
, hiedb ^>= 0.6.0.2
598-
, hie-compat
599600
, hls-plugin-api == 2.11.0.0
600601
, haskell-language-server:hls-refactor-plugin
601602
, lens
@@ -795,7 +796,6 @@ library hls-stan-plugin
795796
build-depends:
796797
, deepseq
797798
, hashable
798-
, hie-compat
799799
, hls-plugin-api
800800
, ghcide
801801
, lsp-types
@@ -1061,6 +1061,7 @@ library hls-qualify-imported-names-plugin
10611061
hs-source-dirs: plugins/hls-qualify-imported-names-plugin/src
10621062
build-depends:
10631063
, containers
1064+
, ghc
10641065
, ghcide == 2.11.0.0
10651066
, hls-plugin-api == 2.11.0.0
10661067
, lens
@@ -1114,6 +1115,7 @@ library hls-code-range-plugin
11141115
, containers
11151116
, deepseq
11161117
, extra
1118+
, ghc
11171119
, ghcide == 2.11.0.0
11181120
, hashable
11191121
, hls-plugin-api == 2.11.0.0
@@ -1314,6 +1316,7 @@ library hls-explicit-record-fields-plugin
13141316
buildable: False
13151317
exposed-modules: Ide.Plugin.ExplicitFields
13161318
build-depends:
1319+
, ghc
13171320
, ghcide == 2.11.0.0
13181321
, hls-plugin-api == 2.11.0.0
13191322
, lsp
@@ -1722,6 +1725,7 @@ library hls-semantic-tokens-plugin
17221725
, extra
17231726
, text-rope
17241727
, mtl >= 2.2
1728+
, ghc
17251729
, ghcide == 2.11.0.0
17261730
, hls-plugin-api == 2.11.0.0
17271731
, lens

hie-compat/CHANGELOG.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)