Skip to content

Commit 3d58a93

Browse files
committed
init to ghcide
1 parent 682d689 commit 3d58a93

File tree

7 files changed

+41
-4
lines changed

7 files changed

+41
-4
lines changed

ghcide/cabal.project

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
packages:
2+
./
3+
4+
allow-newer:
5+
base
6+
, ghc

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ mkHiFileResultCompile se session' tcm simplified_guts = catchErrs $ do
470470
core_file = codeGutsToCoreFile iface_hash guts
471471
iface_hash = getModuleHash final_iface
472472
core_hash1 <- atomicFileWrite se core_fp $ \fp ->
473-
writeBinCoreFile fp core_file
473+
writeBinCoreFile (ms_hspp_opts ms) fp core_file
474474
-- We want to drop references to guts and read in a serialized, compact version
475475
-- of the core file from disk (as it is deserialised lazily)
476476
-- This is because we don't want to keep the guts in memory for every file in

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,12 @@ module Development.IDE.GHC.Compat.Core (
230230
ModuleOrigin(..),
231231
PackageName(..),
232232
-- * Linker
233+
#if !MIN_VERSION_ghc(9,11,0)
233234
Unlinked(..),
235+
#else
236+
LinkablePart(..),
237+
Unlinked,
238+
#endif
234239
Linkable(..),
235240
unload,
236241
-- * Hooks
@@ -537,6 +542,9 @@ import GHC.Utils.Error (mkPlainErrorMsgEnvelope)
537542
import GHC.Utils.Panic
538543
import GHC.Utils.TmpFs
539544
import Language.Haskell.Syntax hiding (FunDep)
545+
#if MIN_VERSION_ghc(9,11,0)
546+
import System.OsPath.Types (OsPath)
547+
#endif
540548

541549
-- See Note [Guidelines For Using CPP In GHCIDE Import Statements]
542550

@@ -549,7 +557,11 @@ import GHC.Types.Avail (greNamePrintableName)
549557
import GHC.Hs (SrcSpanAnn')
550558
#endif
551559

560+
#if !MIN_VERSION_ghc(9,11,0)
552561
mkHomeModLocation :: DynFlags -> ModuleName -> FilePath -> IO Module.ModLocation
562+
#else
563+
mkHomeModLocation :: DynFlags -> ModuleName -> OsPath -> IO Module.ModLocation
564+
#endif
553565
mkHomeModLocation df mn f = pure $ GHC.mkHomeModLocation (GHC.initFinderOpts df) mn f
554566

555567
pattern RealSrcSpan :: SrcLoc.RealSrcSpan -> Maybe BufSpan -> SrcLoc.SrcSpan
@@ -709,7 +721,7 @@ pattern GRE{gre_name, gre_par, gre_lcl, gre_imp} <- RdrName.GRE
709721
#endif
710722
,gre_par, gre_lcl, gre_imp = (toList -> gre_imp)}
711723

712-
collectHsBindsBinders :: CollectPass p => Bag (XRec p (HsBindLR p idR)) -> [IdP p]
724+
collectHsBindsBinders :: CollectPass p => LHsBinds p -> [IdP p]
713725
collectHsBindsBinders x = GHC.collectHsBindsBinders CollNoDictBinders x
714726

715727

@@ -790,3 +802,8 @@ mkSimpleTarget df fp = Target (TargetFile fp Nothing) True (homeUnitId_ df) Noth
790802
#if MIN_VERSION_ghc(9,7,0)
791803
lookupGlobalRdrEnv gre_env occ = lookupGRE gre_env (LookupOccName occ AllRelevantGREs)
792804
#endif
805+
806+
807+
#if MIN_VERSION_ghc(9,11,0)
808+
type Unlinked = LinkablePart
809+
#endif

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ import GHC.Utils.Logger
4040
import GHC.Utils.Outputable
4141
import GHC.Utils.Panic.Plain
4242

43+
#if !MIN_VERSION_ghc(9,11,0)
4344
hscTypecheckRenameWithDiagnostics :: HscEnv -> ModSummary -> HsParsedModule
4445
-> IO ((TcGblEnv, RenamedStuff), Messages GhcMessage)
4546
hscTypecheckRenameWithDiagnostics hsc_env mod_summary rdr_module =
4647
runHsc' hsc_env $ hsc_typecheck True mod_summary (Just rdr_module)
48+
#endif
4749

4850
-- ============================================================================
4951
-- DO NOT EDIT - Refer to top of file

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ import GHC.Iface.Errors.Types (IfaceMessage)
2121
#endif
2222

2323
writeIfaceFile :: HscEnv -> FilePath -> ModIface -> IO ()
24+
#if MIN_VERSION_ghc(9,11,0)
25+
writeIfaceFile env fp iface = Iface.writeIface (hsc_logger env) (targetProfile $ hsc_dflags env) (Iface.flagsToIfCompression $ hsc_dflags env) fp iface
26+
#else
2427
writeIfaceFile env fp iface = Iface.writeIface (hsc_logger env) (targetProfile $ hsc_dflags env) fp iface
28+
#endif
2529

2630
cannotFindModule :: HscEnv -> ModuleName -> FindResult -> SDoc
2731
cannotFindModule env modname fr =

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@ module Development.IDE.GHC.Compat.Parser (
1616
Development.IDE.GHC.Compat.Parser.pm_mod_summary,
1717
Development.IDE.GHC.Compat.Parser.pm_extra_src_files,
1818
-- * API Annotations
19+
#if !MIN_VERSION_ghc(9,11,0)
1920
Anno.AnnKeywordId(..),
21+
#endif
2022
pattern EpaLineComment,
2123
pattern EpaBlockComment
2224
) where
2325

2426
import Development.IDE.GHC.Compat.Core
2527
import Development.IDE.GHC.Compat.Util
28+
#if !MIN_VERSION_ghc(9,11,0)
2629
import qualified GHC.Parser.Annotation as Anno
30+
#endif
2731
import qualified GHC.Parser.Lexer as Lexer
2832
import GHC.Types.SrcLoc (PsSpan (..))
2933

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,18 @@ readBinCoreFile name_cache fat_hi_path = do
8787
return (file, fp)
8888

8989
-- | Write a core file
90-
writeBinCoreFile :: FilePath -> CoreFile -> IO Fingerprint
91-
writeBinCoreFile core_path fat_iface = do
90+
writeBinCoreFile :: DynFlags -> FilePath -> CoreFile -> IO Fingerprint
91+
writeBinCoreFile dflag core_path fat_iface = do
9292
bh <- openBinMem initBinMemSize
9393

9494
let quietTrace =
9595
QuietBinIFace
9696

97+
#if !MIN_VERSION_ghc(9,11,0)
9798
putWithUserData quietTrace bh fat_iface
99+
#else
100+
putWithUserData (Iface.flagsToIfCompression dflag) quietTrace bh fat_iface
101+
#endif
98102

99103
-- And send the result to the file
100104
writeBinMem bh core_path

0 commit comments

Comments
 (0)