Skip to content

Commit

Permalink
Up-(actually down-)grade to ghc-lib-8.8.0.20190610 (#1576)
Browse files Browse the repository at this point in the history
* Up-(actually down-)grade to ghc-lib-8.8.0.20190610

* A `#ifndef GHC_STABLE` removed. `ml_hie_file` must be set unconditionally

* Pass Opt_WriteHie in xFlagsSet

* Oops. Revert. This breaks Windows. Very confusing

* Disable test; track in issue #1582

* Remove Opt_WriteHie flag (Causes test failures trying to write into a read-only filesystem in CI)
  • Loading branch information
Shayne Fletcher authored Jun 11, 2019
1 parent e6c1d1e commit da88ab0
Show file tree
Hide file tree
Showing 16 changed files with 162 additions and 171 deletions.
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ hazel_repositories(
extra =
# Read [Working on ghc-lib] for ghc-lib update instructions at
# https://github.com/DACH-NY/daml/blob/master/ghc-lib/working-on-ghc-lib.md
hazel_ghclibs("0.20190604.1", "283372061a51a6524f2c2940dc328985317cb5134a2beb8fd2a847a9e6e157d5", "522ab61c7fe386e8c8c2d396d063bc5b690e33b056defbb8304141890ec6786e") +
hazel_ghclibs("8.8.0.20190610", "04fcd1d94d4976b3374b260ac45975bfe431d15351e725ee3c6708e4f30a6fdf", "a837ddfd5bb3677cb5c6c25fc12cb8fc29958e101e677f12be6ec39ae78bd2a6") +
hazel_github_external("awakesecurity", "proto3-wire", "43d8220dbc64ef7cc7681887741833a47b61070f", "1c3a7fbf4ab3308776675c6202583f9750de496757f3ad4815e81edd122d75e1") +
hazel_github_external("awakesecurity", "proto3-suite", "dd01df7a3f6d0f1ea36125a67ac3c16936b53da0", "59ea7b876b14991347918eefefe24e7f0e064b5c2cc14574ac4ab5d6af6413ca") +
hazel_hackage("happy", "1.19.10", "22eb606c97105b396e1c7dc27e120ca02025a87f3e44d2ea52be6a653a52caed") +
Expand Down
15 changes: 2 additions & 13 deletions compiler/haskell-ide-core/src/Development/IDE/Compat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,11 @@
-- | Attempt at hiding the GHC version differences we can.
module Development.IDE.Compat(
HieFile(..),
HieFileResult(..),
mkHieFile,
writeHieFile,
readHieFile
) where

#ifndef GHC_STABLE
import HieBin
import HieAst
import HieTypes
#else

import GHC
import GhcPlugins
import NameCache
Expand All @@ -31,11 +24,7 @@ mkHieFile _ _ _ = return (HieFile () [])
writeHieFile :: FilePath -> HieFile -> IO ()
writeHieFile _ _ = return ()

readHieFile :: NameCache -> FilePath -> IO (HieFileResult, ())
readHieFile _ _ = return (HieFileResult $ HieFile () [], ())
readHieFile :: NameCache -> FilePath -> IO (HieFile, ())
readHieFile _ _ = return (HieFile () [], ())

data HieFile = HieFile {hie_module :: (), hie_exports :: [AvailInfo]}

data HieFileResult = HieFileResult {hie_file_result :: HieFile}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ doCpp dflags raw input_fn output_fn = do

let cpp_prog args | raw = SysTools.runCpp dflags args
| otherwise = SysTools.runCc
#ifndef GHC_STABLE
Nothing
#endif
dflags (SysTools.Option "-E" : args)

let target_defs = [] {-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,8 @@ parseFileContents preprocessor filename contents = do
return (contents, dflags)

case unP Parser.parseModule (mkPState dflags contents loc) of
#ifdef GHC_STABLE
PFailed _ locErr msgErr ->
Ex.throwE $ mkErrorDoc dflags locErr msgErr
#else
PFailed s ->
-- A fatal parse error was encountered.
Ex.throwE $ toDiagnostics dflags $ snd $ getMessages s dflags
#endif
POk pst rdr_module ->
let hpm_annotations =
(Map.fromListWith (++) $ annotations pst,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ getHieFileRule =
defineNoFile $ \(GetHieFile f) -> do
u <- liftIO $ mkSplitUniqSupply 'a'
let nameCache = initNameCache u []
liftIO $ fmap (hie_file_result . fst) $ readHieFile nameCache f
liftIO $ fmap fst $ readHieFile nameCache f

-- | A rule that wires per-file rules together
mainRule :: Rules ()
Expand Down
19 changes: 0 additions & 19 deletions compiler/haskell-ide-core/src/Development/IDE/UtilGHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ import Data.IORef
import Control.Exception
import FileCleanup
import Platform
#ifndef GHC_STABLE
import ToolSettings
#endif

----------------------------------------------------------------------
-- GHC setup
Expand Down Expand Up @@ -73,25 +70,9 @@ fakeDynFlags = defaultDynFlags settings ([], [])
settings = Settings
{ sTargetPlatform = platform
, sPlatformConstants = platformConstants
#ifdef GHC_STABLE
, sProgramName = "ghc"
, sProjectVersion = cProjectVersion
, sOpt_P_fingerprint = fingerprint0
#else
, sGhcNameVersion = GhcNameVersion
{ ghcNameVersion_programName = "ghc"
, ghcNameVersion_projectVersion = cProjectVersion
}
, sFileSettings = FileSettings
{ -- fileSettings_tmpDir = "."
}
, sPlatformMisc = PlatformMisc
{ platformMisc_integerLibraryType = IntegerSimple
}
, sToolSettings = ToolSettings
{ toolSettings_opt_P_fingerprint = fingerprint0
}
#endif
}
platform = Platform
{ platformWordSize=8
Expand Down
28 changes: 14 additions & 14 deletions daml-foundations/daml-ghc/daml-prim-src/GHC/Classes.daml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-- Copied from https://github.com/ghc/ghc/blob/23f6f31dd66d7c370cb8beec3f1d96a0cb577393/libraries/ghc-prim/GHC/Classes.hs
-- All DA specific modifications are marked with [DA]

{-# LANGUAGE NoNewColonConvention #-} -- [DA]
{-# LANGUAGE DamlSyntax #-} -- [DA]

-- [DA] {-# LANGUAGE CPP #-}
{-# LANGUAGE Trustworthy #-}
Expand Down Expand Up @@ -69,8 +69,8 @@ default () -- Double isn't available yet
-- | The syntax `?x :: a` is desugared into `IP "x" a`
-- IP is declared very early, so that libraries can take
-- advantage of the implicit-call-stack feature
class IP (x :: Symbol) a | x -> a where
ip :: a
class IP (x : Symbol) a | x -> a where
ip : a

{- $matching_overloaded_methods_in_rules
Expand Down Expand Up @@ -137,7 +137,7 @@ for the types in "GHC.Word" and "GHC.Int".
-- Minimal complete definition: either `==` or `/=`.
--
class Eq a where
(==), (/=) :: a -> a -> Bool
(==), (/=) : a -> a -> Bool

x /= y = not (x == y)
x == y = not (x /= y)
Expand Down Expand Up @@ -181,7 +181,7 @@ deriving instance (Eq a, Eq b) => Eq (Either a b)

-- slightly strange encoding to avoid value level recursion
-- and to optimise so we avoid going through the dictionary lots of times
eqList :: (a -> a -> Bool) -> [a] -> [a] -> Bool
eqList : (a -> a -> Bool) -> [a] -> [a] -> Bool
eqList = primitive @"BEEqualList"

instance (Eq a) => Eq [a] where
Expand Down Expand Up @@ -234,9 +234,9 @@ instance Eq Text where
-- Using `compare` can be more efficient for complex types.
--
class (Eq a) => Ord a where
compare :: a -> a -> Ordering
(<), (<=), (>), (>=) :: a -> a -> Bool
max, min :: a -> a -> a
compare : a -> a -> Ordering
(<), (<=), (>), (>=) : a -> a -> Bool
max, min : a -> a -> a

compare x y = if x == y then EQ
-- NB: must be '<=' not '<' to validate the
Expand Down Expand Up @@ -294,9 +294,9 @@ deriving instance (Ord a, Ord b) => Ord (Either a b)

instance (Ord a) => Ord [a] where
compare [] [] = EQ
compare [] (_:_) = LT
compare (_:_) [] = GT
compare (x:xs) (y:ys) = case compare x y of
compare [] (_ :: _) = LT
compare (_ :: _) [] = GT
compare (x :: xs) (y :: ys) = case compare x y of
EQ -> compare xs ys
other -> other

Expand Down Expand Up @@ -336,19 +336,19 @@ instance Ord Text where
-- This function has short-circuiting semantics, i.e., when both arguments are
-- present and the first arguments evaluates to 'False', the second argument
-- is not evaluated at all.
(&&) :: Bool -> Bool -> Bool
(&&) : Bool -> Bool -> Bool
True && x = x
False && _ = False

-- | Boolean \"or\".
-- This function has short-circuiting semantics, i.e., when both arguments are
-- present and the first arguments evaluates to 'True', the second argument
-- is not evaluated at all.
(||) :: Bool -> Bool -> Bool
(||) : Bool -> Bool -> Bool
True || _ = True
False || x = x

-- | Boolean \"not\"
not :: Bool -> Bool
not : Bool -> Bool
not True = False
not False = True
2 changes: 1 addition & 1 deletion daml-foundations/daml-ghc/daml-prim-src/GHC/Tuple.daml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-- Copied from https://github.com/ghc/ghc/blob/23f6f31dd66d7c370cb8beec3f1d96a0cb577393/libraries/ghc-prim/GHC/Tuple.hs
-- All DA specific modifications are marked with [DA]

{-# LANGUAGE NoNewColonConvention #-} -- [DA]
{-# LANGUAGE DamlSyntax #-} -- [DA]
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude, DeriveGeneric #-}
{-# OPTIONS -Wno-unused-binds #-} -- the Tuple types are not exported
Expand Down
Loading

0 comments on commit da88ab0

Please sign in to comment.