packages feed

hie-compat 0.2.0.0 → 0.2.1.0

raw patch · 14 files changed

+39/−151 lines, 14 filesnew-uploaderPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Compat.HieAst: mkHieFile :: ModSummary -> TcGblEnv -> RenamedSource -> ByteString -> Hsc HieFile

Files

hie-compat.cabal view
@@ -1,6 +1,6 @@ cabal-version:       1.22 name:                hie-compat-version:             0.2.0.0+version:             0.2.1.0 synopsis:            HIE files for GHC 8.6 and other HIE file backports license:             Apache-2.0 description:@@ -30,6 +30,8 @@     build-depends: ghc, ghc-boot   if (impl(ghc >= 9.0) && impl(ghc < 9.1))     ghc-options: -Wall -Wno-name-shadowing+  else+    ghc-options: -Wall -Wno-name-shadowing    exposed-modules:     Compat.HieAst@@ -45,5 +47,8 @@   if (impl(ghc > 8.9) && impl(ghc < 8.11))     hs-source-dirs: src-ghc810 src-reexport   if (impl(ghc >= 9.0) && impl(ghc < 9.1) || flag(ghc-lib))-    hs-source-dirs: src-ghc901+    hs-source-dirs: src-reexport-ghc9+  if (impl(ghc >= 9.2) && impl(ghc < 9.3))+    hs-source-dirs: src-reexport-ghc9+ 
src-ghc810/Compat/HieAst.hs view
@@ -17,7 +17,7 @@ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE DeriveDataTypeable #-}-module Compat.HieAst ( mkHieFile, enrichHie ) where+module Compat.HieAst ( enrichHie ) where  import GhcPrelude @@ -32,7 +32,7 @@ import FieldLabel import GHC.Hs import HscTypes-import Module                     ( ModuleName, ml_hs_file )+import Module                     ( ModuleName ) import MonadUtils                 ( concatMapM, liftIO ) import Name                       ( Name, nameSrcSpan ) import NameEnv                    ( NameEnv, emptyNameEnv, extendNameEnv, lookupNameEnv )@@ -41,15 +41,11 @@ import Type                       ( mkVisFunTys, Type ) import TysWiredIn                 ( mkListTy, mkSumTy ) import Var                        ( Id, Var, setVarName, varName, varType )-import TcRnTypes-import MkIface                    ( mkIfaceExports ) import Panic  import HieTypes import HieUtils -import qualified Data.Array as A-import qualified Data.ByteString as BS import qualified Data.Map as M import qualified Data.Set as S import Data.Data                  ( Data, Typeable )@@ -222,31 +218,6 @@     go _ f = f  type HieM = ReaderT HieState Hsc---- | Construct an 'HieFile' from the outputs of the typechecker.-mkHieFile :: ModSummary-          -> TcGblEnv-          -> RenamedSource-          -> BS.ByteString -> Hsc HieFile-mkHieFile ms ts rs src = do-  let tc_binds = tcg_binds ts-  (asts', arr) <- getCompressedAsts tc_binds rs-  let Just src_file = ml_hs_file $ ms_location ms-  return $ HieFile-      { hie_hs_file = src_file-      , hie_module = ms_mod ms-      , hie_types = arr-      , hie_asts = asts'-      -- mkIfaceExports sorts the AvailInfos for stability-      , hie_exports = mkIfaceExports (tcg_exports ts)-      , hie_hs_src = src-      }--getCompressedAsts :: TypecheckedSource -> RenamedSource-  -> Hsc (HieASTs TypeIndex, A.Array TypeIndex HieTypeFlat)-getCompressedAsts ts rs = do-  asts <- enrichHie ts rs-  return $ compressTypes asts  enrichHie :: TypecheckedSource -> RenamedSource -> Hsc (HieASTs Type) enrichHie ts (hsGrp, imports, exports, _) = flip runReaderT initState $ do
src-ghc86/Compat/HieAst.hs view
@@ -17,7 +17,7 @@ {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DataKinds #-}-module Compat.HieAst ( mkHieFile, enrichHie ) where+module Compat.HieAst ( enrichHie ) where  import Avail                      ( Avails ) import Bag                        ( Bag, bagToList )@@ -30,7 +30,7 @@ import FieldLabel import HsSyn import HscTypes-import Module                     ( ModuleName, ml_hs_file )+import Module                     ( ModuleName ) import MonadUtils                 ( concatMapM, liftIO ) import Name                       ( Name, nameSrcSpan ) import SrcLoc@@ -38,14 +38,10 @@ import Type                       ( mkFunTys, Type ) import TysWiredIn                 ( mkListTy, mkSumTy ) import Var                        ( Id, Var, setVarName, varName, varType )-import TcRnTypes-import MkIface                    ( mkIfaceExports )  import Compat.HieTypes import Compat.HieUtils -import qualified Data.Array as A-import qualified Data.ByteString as BS import qualified Data.Map as M import qualified Data.Set as S import Data.Data                  ( Data, Typeable )@@ -100,32 +96,6 @@     go _ f = f  type HieM = ReaderT HieState Hsc---- | Construct an 'HieFile' from the outputs of the typechecker.-mkHieFile :: ModSummary-          -> TcGblEnv-          -> RenamedSource-          -> BS.ByteString-          -> Hsc HieFile-mkHieFile ms ts rs src = do-  let tc_binds = tcg_binds ts-  (asts', arr) <- getCompressedAsts tc_binds rs-  let Just src_file = ml_hs_file $ ms_location ms-  return $ HieFile-      { hie_hs_file = src_file-      , hie_module = ms_mod ms-      , hie_types = arr-      , hie_asts = asts'-      -- mkIfaceExports sorts the AvailInfos for stability-      , hie_exports = mkIfaceExports (tcg_exports ts)-      , hie_hs_src = src-      }--getCompressedAsts :: TypecheckedSource -> RenamedSource-  -> Hsc (HieASTs TypeIndex, A.Array TypeIndex HieTypeFlat)-getCompressedAsts ts rs = do-  asts <- enrichHie ts rs-  return $ compressTypes asts  enrichHie :: TypecheckedSource -> RenamedSource -> Hsc (HieASTs Type) enrichHie ts (hsGrp, imports, exports, _) = flip runReaderT initState $ do
src-ghc88/Compat/HieAst.hs view
@@ -16,7 +16,7 @@ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE DeriveDataTypeable #-}-module Compat.HieAst ( mkHieFile, enrichHie ) where+module Compat.HieAst ( enrichHie ) where  import Avail                      ( Avails ) import Bag                        ( Bag, bagToList )@@ -89,32 +89,6 @@     go _ f = f  type HieM = ReaderT HieState Hsc---- | Construct an 'HieFile' from the outputs of the typechecker.-mkHieFile :: ModSummary-          -> TcGblEnv-          -> RenamedSource-          -> BS.ByteString-          -> Hsc HieFile-mkHieFile ms ts rs src = do-  let tc_binds = tcg_binds ts-  (asts', arr) <- getCompressedAsts tc_binds rs-  let Just src_file = ml_hs_file $ ms_location ms-  return $ HieFile-      { hie_hs_file = src_file-      , hie_module = ms_mod ms-      , hie_types = arr-      , hie_asts = asts'-      -- mkIfaceExports sorts the AvailInfos for stability-      , hie_exports = mkIfaceExports (tcg_exports ts)-      , hie_hs_src = src-      }--getCompressedAsts :: TypecheckedSource -> RenamedSource-  -> Hsc (HieASTs TypeIndex, A.Array TypeIndex HieTypeFlat)-getCompressedAsts ts rs = do-  asts <- enrichHie ts rs-  return $ compressTypes asts  enrichHie :: TypecheckedSource -> RenamedSource -> Hsc (HieASTs Type) enrichHie ts (hsGrp, imports, exports, _) = flip runReaderT initState $ do
− src-ghc901/Compat/HieAst.hs
@@ -1,35 +0,0 @@-{--Forked from GHC v9.0.1 to work around the readFile side effect in mkHiefile--Main functions for .hie file generation--}-{- HLINT ignore -}-{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}--module Compat.HieAst ( mkHieFile, enrichHie ) where--import           GHC.Data.Maybe      (expectJust)-import           GHC.Driver.Types-import           GHC.Hs-import           GHC.Tc.Types        (TcGblEnv)-import           GHC.Types.Avail     (Avails)-import           GHC.Unit.Module     (ml_hs_file)--import           GHC.Iface.Ext.Ast   (enrichHie, mkHieFileWithSource)-import           GHC.Iface.Ext.Types--import qualified Data.ByteString     as BS---type RenamedSource     = ( HsGroup GhcRn, [LImportDecl GhcRn]-                         , Maybe [(LIE GhcRn, Avails)]-                         , Maybe LHsDocString )---- | Construct an 'HieFile' from the outputs of the typechecker.-mkHieFile :: ModSummary-          -> TcGblEnv-          -> RenamedSource-          -> BS.ByteString -> Hsc HieFile-mkHieFile ms ts rs src = do-  let src_file = expectJust "mkHieFile" (ml_hs_file $ ms_location ms)-  mkHieFileWithSource src_file src ms ts rs
− src-ghc901/Compat/HieBin.hs
@@ -1,8 +0,0 @@-{--Binary serialization for .hie files.--}--module Compat.HieBin ( module GHC.Iface.Ext.Binary)-where--import GHC.Iface.Ext.Binary
− src-ghc901/Compat/HieDebug.hs
@@ -1,10 +0,0 @@-module Compat.HieDebug-  ( module GHC.Iface.Ext.Debug-  , ppHie ) where-import GHC.Iface.Ext.Debug--import GHC.Iface.Ext.Types (HieAST)-import GHC.Utils.Outputable (Outputable(ppr), SDoc)--ppHie :: Outputable a => HieAST a -> SDoc-ppHie = ppr
− src-ghc901/Compat/HieTypes.hs
@@ -1,3 +0,0 @@-module Compat.HieTypes-  ( module GHC.Iface.Ext.Types ) where-import GHC.Iface.Ext.Types
− src-ghc901/Compat/HieUtils.hs
@@ -1,3 +0,0 @@-module Compat.HieUtils-  ( module GHC.Iface.Ext.Utils ) where-import GHC.Iface.Ext.Utils
+ src-reexport-ghc9/Compat/HieAst.hs view
@@ -0,0 +1,3 @@+module Compat.HieAst ( enrichHie ) where++import           GHC.Iface.Ext.Ast   (enrichHie)
+ src-reexport-ghc9/Compat/HieBin.hs view
@@ -0,0 +1,8 @@+{-+Binary serialization for .hie files.+-}++module Compat.HieBin ( module GHC.Iface.Ext.Binary)+where++import GHC.Iface.Ext.Binary
+ src-reexport-ghc9/Compat/HieDebug.hs view
@@ -0,0 +1,10 @@+module Compat.HieDebug+  ( module GHC.Iface.Ext.Debug+  , ppHie ) where+import GHC.Iface.Ext.Debug++import GHC.Iface.Ext.Types (HieAST)+import GHC.Utils.Outputable (Outputable(ppr), SDoc)++ppHie :: Outputable a => HieAST a -> SDoc+ppHie = ppr
+ src-reexport-ghc9/Compat/HieTypes.hs view
@@ -0,0 +1,3 @@+module Compat.HieTypes+  ( module GHC.Iface.Ext.Types ) where+import GHC.Iface.Ext.Types
+ src-reexport-ghc9/Compat/HieUtils.hs view
@@ -0,0 +1,3 @@+module Compat.HieUtils+  ( module GHC.Iface.Ext.Utils ) where+import GHC.Iface.Ext.Utils