Skip to content

Remove hie-compat #4613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
/hls-graph @wz1000
/hls-plugin-api @michaelpj @fendor
/hls-test-utils @fendor
/hie-compat @wz1000

# HLS main
/src @fendor
Expand Down
1 change: 0 additions & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
- [ ] bump package versions in all `*.cabal` files (same version as hls)
- HLS uses lockstep versioning. The core packages and all plugins use the same version number, and only support exactly this version.
- Exceptions:
- `hie-compat` requires no automatic version bump.
- `shake-bench` is an internal testing tool, not exposed to the outside world. Thus, no version bump required for releases.
- For updating cabal files, the following script can be used:
- ```sh
Expand Down
1 change: 0 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
packages:
./
./hie-compat
./shake-bench
./hls-graph
./ghcide
Expand Down
1 change: 0 additions & 1 deletion docs/contributing/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ pre-commit install
#### Why are some components excluded from automatic formatting?

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

## Plugin tutorial

Expand Down
1 change: 0 additions & 1 deletion ghcide/ghcide.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ library
, haddock-library >=1.8 && <1.12
, hashable
, hie-bios ^>=0.15.0
, hie-compat ^>=0.3.0.0
, hiedb ^>= 0.6.0.2
, hls-graph == 2.11.0.0
, hls-plugin-api == 2.11.0.0
Expand Down
1 change: 1 addition & 0 deletions ghcide/src/Development/IDE/Core/Actions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import Development.IDE.Graph
import qualified Development.IDE.Spans.AtPoint as AtPoint
import Development.IDE.Types.HscEnvEq (hscEnv)
import Development.IDE.Types.Location
import GHC.Iface.Ext.Types (Identifier)
import qualified HieDb
import Language.LSP.Protocol.Types (DocumentHighlight (..),
SymbolInformation (..),
Expand Down
2 changes: 2 additions & 0 deletions ghcide/src/Development/IDE/Core/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
import Data.Time (UTCTime (..))
import Data.Tuple.Extra (dupe)
import Debug.Trace
import Development.IDE.Core.FileStore (resetInterfaceStore)

Check warning on line 73 in ghcide/src/Development/IDE/Core/Compile.hs

View workflow job for this annotation

GitHub Actions / Hlint check run

Warning in module Development.IDE.Core.Compile: Use fewer imports ▫︎ Found: "import Development.IDE.Core.FileStore ( resetInterfaceStore )\nimport Development.IDE.Core.FileStore ( shareFilePath )\n" ▫︎ Perhaps: "import Development.IDE.Core.FileStore\n ( resetInterfaceStore, shareFilePath )\n"
import Development.IDE.Core.Preprocessor
import Development.IDE.Core.ProgressReporting (progressUpdate)
import Development.IDE.Core.RuleTypes
Expand Down Expand Up @@ -109,6 +109,7 @@
import qualified GHC as G
import GHC.Core.Lint.Interactive
import GHC.Driver.Config.CoreToStg.Prep
import GHC.Iface.Ext.Types (HieASTs)
import qualified GHC.Runtime.Loader as Loader
import GHC.Tc.Gen.Splice
import GHC.Types.Error
Expand Down Expand Up @@ -145,6 +146,7 @@
import qualified Data.List.NonEmpty as NE
import Data.Time (getCurrentTime)
import GHC.Driver.Env (hsc_all_home_unit_ids)
import GHC.Iface.Ext.Types (NameEntityInfo)
#endif

#if MIN_VERSION_ghc(9,12,0)
Expand Down Expand Up @@ -823,7 +825,7 @@
tcs = tcg_tcs ts :: [TyCon]
hie_asts = GHC.enrichHie all_binds (tmrRenamed tcm) top_ev_binds insts tcs

pure $ Just $

Check warning on line 828 in ghcide/src/Development/IDE/Core/Compile.hs

View workflow job for this annotation

GitHub Actions / Hlint check run

Suggestion in generateHieAsts in module Development.IDE.Core.Compile: Redundant $ ▫︎ Found: "Just $ hie_asts" ▫︎ Perhaps: "Just hie_asts"
#if MIN_VERSION_ghc(9,11,0)
hie_asts (tcg_type_env ts)
#else
Expand Down Expand Up @@ -1103,7 +1105,7 @@


convImport (L _ i) = (
(ideclPkgQual i)

Check warning on line 1108 in ghcide/src/Development/IDE/Core/Compile.hs

View workflow job for this annotation

GitHub Actions / Hlint check run

Suggestion in getModSummaryFromImports in module Development.IDE.Core.Compile: Redundant bracket ▫︎ Found: "((ideclPkgQual i), reLoc $ ideclName i)" ▫︎ Perhaps: "(ideclPkgQual i, reLoc $ ideclName i)"
, reLoc $ ideclName i)

msrImports = implicit_imports ++ imps
Expand Down
3 changes: 3 additions & 0 deletions ghcide/src/Development/IDE/Core/RuleTypes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ import Development.IDE.Import.DependencyInformation
import Development.IDE.Types.HscEnvEq (HscEnvEq)
import Development.IDE.Types.KnownTargets
import GHC.Generics (Generic)
import GHC.Iface.Ext.Types (HieASTs,
TypeIndex)
import GHC.Iface.Ext.Utils (RefMap)

import Data.ByteString (ByteString)
import Data.Text.Utf16.Rope.Mixed (Rope)
Expand Down
8 changes: 5 additions & 3 deletions ghcide/src/Development/IDE/Core/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@
import Development.IDE.Types.Location
import Development.IDE.Types.Options
import qualified Development.IDE.Types.Shake as Shake
import GHC.Iface.Ext.Types (HieASTs (..))
import GHC.Iface.Ext.Utils (generateReferencesMap)
import qualified GHC.LanguageExtensions as LangExt
import HIE.Bios.Ghc.Gap (hostIsDynamic)
import qualified HieDb
Expand Down Expand Up @@ -512,7 +514,7 @@
(currentSource, ver) <- liftIO $ case M.lookup (filePathToUri' file) vfsData of
Nothing -> (,Nothing) . T.decodeUtf8 <$> BS.readFile (fromNormalizedFilePath file)
Just vf -> pure (virtualFileText vf, Just $ virtualFileVersion vf)
let refmap = Compat.generateReferencesMap . Compat.getAsts . Compat.hie_asts $ res
let refmap = generateReferencesMap . getAsts . Compat.hie_asts $ res
del = deltaFromDiff (T.decodeUtf8 $ Compat.hie_hs_src res) currentSource
pure (HAR (Compat.hie_module res) (Compat.hie_asts res) refmap mempty (HieFromDisk res),del,ver)

Expand Down Expand Up @@ -540,8 +542,8 @@
liftIO $ writeAndIndexHieFile hsc se modSummary f exports asts source
_ -> pure []

let refmap = Compat.generateReferencesMap . Compat.getAsts <$> masts
typemap = AtPoint.computeTypeReferences . Compat.getAsts <$> masts
let refmap = generateReferencesMap . getAsts <$> masts
typemap = AtPoint.computeTypeReferences . getAsts <$> masts
pure (diags <> diagsWrite, HAR (ms_mod $ tmrModSummary tmr) <$> masts <*> refmap <*> typemap <*> pure HieFresh)

getImportMapRule :: Recorder (WithPriority Log) -> Rules ()
Expand Down Expand Up @@ -802,7 +804,7 @@
{ source_version = ver
, old_value = m_old
, get_file_version = use GetModificationTime_{missingFileDiagnostics = False}
, get_linkable_hashes = \fs -> map (snd . fromJust . hirCoreFp) <$> uses_ GetModIface fs

Check warning on line 807 in ghcide/src/Development/IDE/Core/Rules.hs

View workflow job for this annotation

GitHub Actions / Hlint check run

Suggestion in getModIfaceFromDiskRule in module Development.IDE.Core.Rules: Use fmap ▫︎ Found: "\\ fs -> map (snd . fromJust . hirCoreFp) <$> uses_ GetModIface fs" ▫︎ Perhaps: "fmap (map (snd . fromJust . hirCoreFp)) . uses_ GetModIface"
, get_module_graph = useWithSeparateFingerprintRule_ GetModuleGraphTransDepsFingerprints GetModuleGraph f
, regenerate = regenerateHiFile session f ms
}
Expand Down
16 changes: 7 additions & 9 deletions ghcide/src/Development/IDE/GHC/Compat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ module Development.IDE.GHC.Compat(
readHieFile,
setHieDir,
dontWriteHieFiles,
module Compat.HieTypes,
module Compat.HieUtils,
-- * Compat modules
module Development.IDE.GHC.Compat.Core,
module Development.IDE.GHC.Compat.Env,
Expand Down Expand Up @@ -112,14 +110,8 @@ module Development.IDE.GHC.Compat(
#if MIN_VERSION_ghc(9,7,0)
tcInitTidyEnv,
#endif
) where

import Compat.HieAst (enrichHie)
import Compat.HieBin
import Compat.HieTypes hiding
(nodeAnnotations)
import qualified Compat.HieTypes as GHC (nodeAnnotations)
import Compat.HieUtils
) where
import Control.Applicative ((<|>))
import qualified Data.ByteString as BS
import Data.Coerce (coerce)
Expand All @@ -146,12 +138,18 @@ import GHC.Core.Tidy (tidyExpr)
import GHC.CoreToStg.Prep (corePrepPgm)
import qualified GHC.CoreToStg.Prep as GHC
import GHC.Driver.Hooks (hscCompileCoreExprHook)
import GHC.Iface.Ext.Types hiding
(nodeAnnotations)
import qualified GHC.Iface.Ext.Types as GHC (nodeAnnotations)
import GHC.Iface.Ext.Utils

import GHC.ByteCode.Asm (bcoFreeNames)
import GHC.Core
import GHC.Data.FastString
import GHC.Data.StringBuffer
import GHC.Driver.Session hiding (ExposePackage)
import GHC.Iface.Ext.Ast (enrichHie)
import GHC.Iface.Ext.Binary
import GHC.Iface.Make (mkIfaceExports)
import GHC.SysTools.Tasks (runPp, runUnlit)
import GHC.Types.Annotations (AnnTarget (ModuleTarget),
Expand Down
1 change: 0 additions & 1 deletion ghcide/src/Development/IDE/GHC/CoreFile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import Data.Foldable
import Data.IORef
import Data.List (isPrefixOf)
import Data.Maybe
import qualified Data.Text as T
import Development.IDE.GHC.Compat
import qualified Development.IDE.GHC.Compat.Util as Util
import GHC.Core
Expand Down
7 changes: 2 additions & 5 deletions ghcide/src/Development/IDE/GHC/Orphans.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
-- | Orphan instances for GHC.
-- Note that the 'NFData' instances may not be law abiding.
module Development.IDE.GHC.Orphans() where
import Development.IDE.GHC.Compat hiding
(DuplicateRecordFields,
FieldSelectors)
import Development.IDE.GHC.Compat
import Development.IDE.GHC.Util

import Control.DeepSeq
Expand All @@ -24,9 +22,8 @@ import GHC.ByteCode.Types
import GHC.Data.Bag
import GHC.Data.FastString
import qualified GHC.Data.StringBuffer as SB
import GHC.Iface.Ext.Types
import GHC.Parser.Annotation
import GHC.Types.FieldLabel (DuplicateRecordFields (DuplicateRecordFields, NoDuplicateRecordFields),
FieldSelectors (FieldSelectors, NoFieldSelectors))
import GHC.Types.PkgQual
import GHC.Types.SrcLoc

Expand Down
3 changes: 3 additions & 0 deletions ghcide/src/Development/IDE/Plugin/Completions/Logic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ import Development.IDE.Plugin.Completions.Types
import Development.IDE.Spans.LocalBindings
import Development.IDE.Types.Exports
import Development.IDE.Types.Options
import GHC.Iface.Ext.Types (HieAST,
NodeInfo (..))
import GHC.Iface.Ext.Utils (nodeInfo)
import Ide.PluginUtils (mkLspCommand)
import Ide.Types (CommandId (..),
IdePlugins (..),
Expand Down
19 changes: 18 additions & 1 deletion ghcide/src/Development/IDE/Spans/AtPoint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@ import Data.Tree
import qualified Data.Tree as T
import Data.Version (showVersion)
import Development.IDE.Types.Shake (WithHieDb)
import GHC.Iface.Ext.Types (EvVarSource (..),
HieAST (..),
HieASTs (..),
HieArgs (..),
HieType (..), Identifier,
IdentifierDetails (..),
NodeInfo (..), Scope,
Span)
import GHC.Iface.Ext.Utils (EvidenceInfo (..),
RefMap, getEvidenceTree,
getScopeFromContext,
hieTypeToIface,
isEvidenceContext,
isEvidenceUse,
isOccurrence, nodeInfo,
recoverFullType,
selectSmallestContaining)
import HieDb hiding (pointCommand,
withHieDb)
import System.Directory (doesFileExist)
Expand Down Expand Up @@ -488,7 +505,7 @@ instanceLocationsAtPoint
instanceLocationsAtPoint withHieDb lookupModule _ideOptions pos (HAR _ ast _rm _ _) =
let ns = concat $ pointCommand ast pos (M.keys . getNodeIds)
evTrees = mapMaybe (eitherToMaybe >=> getEvidenceTree _rm) ns
evNs = concatMap (map (evidenceVar) . T.flatten) evTrees
evNs = concatMap (map evidenceVar . T.flatten) evTrees
in fmap (nubOrd . concat) $ mapMaybeM
(nameToLocation withHieDb lookupModule)
evNs
Expand Down
1 change: 1 addition & 0 deletions ghcide/src/Development/IDE/Spans/Documentation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import Development.IDE.GHC.Compat.Util
import Development.IDE.GHC.Error
import Development.IDE.GHC.Util (printOutputable)
import Development.IDE.Spans.Common
import GHC.Iface.Ext.Utils (RefMap)
import Language.LSP.Protocol.Types (filePathToUri, getUri)
import Prelude hiding (mod)
import System.Directory
Expand Down
11 changes: 6 additions & 5 deletions ghcide/src/Development/IDE/Spans/LocalBindings.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ import qualified Data.IntervalMap.FingerTree as IM
import qualified Data.List as L
import qualified Data.Map as M
import qualified Data.Set as S
import GHC.Iface.Ext.Types (IdentifierDetails (..),
Scope (..))
import GHC.Iface.Ext.Utils (RefMap, getBindSiteFromContext,
getScopeFromContext)

import Development.IDE.GHC.Compat (Name, NameEnv, RealSrcSpan,
RefMap, Scope (..), Type,
getBindSiteFromContext,
getScopeFromContext, identInfo,
identType, isSystemName,
Type, isSystemName,
nonDetNameEnvElts,
realSrcSpanEnd,
realSrcSpanStart, unitNameEnv)

import Development.IDE.GHC.Error
import Development.IDE.Types.Location

Expand Down
8 changes: 6 additions & 2 deletions haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ library hls-call-hierarchy-plugin
, aeson
, containers
, extra
, ghc
, ghcide == 2.11.0.0
, hiedb ^>= 0.6.0.2
, hls-plugin-api == 2.11.0.0
Expand Down Expand Up @@ -592,10 +593,10 @@ library hls-rename-plugin
hs-source-dirs: plugins/hls-rename-plugin/src
build-depends:
, containers
, ghc
, ghcide == 2.11.0.0
, hashable
, hiedb ^>= 0.6.0.2
, hie-compat
, hls-plugin-api == 2.11.0.0
, haskell-language-server:hls-refactor-plugin
, lens
Expand Down Expand Up @@ -795,7 +796,6 @@ library hls-stan-plugin
build-depends:
, deepseq
, hashable
, hie-compat
, hls-plugin-api
, ghcide
, lsp-types
Expand Down Expand Up @@ -1061,6 +1061,7 @@ library hls-qualify-imported-names-plugin
hs-source-dirs: plugins/hls-qualify-imported-names-plugin/src
build-depends:
, containers
, ghc
, ghcide == 2.11.0.0
, hls-plugin-api == 2.11.0.0
, lens
Expand Down Expand Up @@ -1114,6 +1115,7 @@ library hls-code-range-plugin
, containers
, deepseq
, extra
, ghc
, ghcide == 2.11.0.0
, hashable
, hls-plugin-api == 2.11.0.0
Expand Down Expand Up @@ -1314,6 +1316,7 @@ library hls-explicit-record-fields-plugin
buildable: False
exposed-modules: Ide.Plugin.ExplicitFields
build-depends:
, ghc
, ghcide == 2.11.0.0
, hls-plugin-api == 2.11.0.0
, lsp
Expand Down Expand Up @@ -1722,6 +1725,7 @@ library hls-semantic-tokens-plugin
, extra
, text-rope
, mtl >= 2.2
, ghc
, ghcide == 2.11.0.0
, hls-plugin-api == 2.11.0.0
, lens
Expand Down
5 changes: 0 additions & 5 deletions hie-compat/CHANGELOG.md

This file was deleted.

Loading
Loading