Skip to content
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

Ghc 8.12 features #6947

Merged
merged 3 commits into from
Jul 8, 2020
Merged
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
2 changes: 1 addition & 1 deletion Cabal/Distribution/Simple/GHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ configure verbosity hcPath hcPkgPath conf0 = do
let implInfo = ghcVersionImplInfo ghcVersion

-- Cabal currently supports ghc >= 7.0.1 && < 8.12
unless (ghcVersion < mkVersion [8,12]) $
unless (ghcVersion < mkVersion [8,14]) $
warn verbosity $
"Unknown/unsupported 'ghc' version detected "
++ "(Cabal " ++ prettyShow cabalVersion ++ " supports 'ghc' version < 8.12): "
Expand Down
3 changes: 2 additions & 1 deletion Cabal/Distribution/Simple/Program/GHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ normaliseGhcArgs (Just ghcVersion) PackageDescription{..} ghcArgs
supportedGHCVersions :: VersionRange
supportedGHCVersions = intersectVersionRanges
(orLaterVersion (mkVersion [8,0]))
(earlierVersion (mkVersion [8,11]))
(earlierVersion (mkVersion [8,13]))

from :: Monoid m => [Int] -> m -> m
from version flags
Expand Down Expand Up @@ -237,6 +237,7 @@ normaliseGhcArgs (Just ghcVersion) PackageDescription{..} ghcArgs
, from [8,4] $ to [8,6] [ "-fno-max-valid-substitutions" ]
, from [8,6] [ "-dhex-word-literals" ]
, from [8,8] [ "-fshow-docs-of-hole-fits", "-fno-show-docs-of-hole-fits" ]
, from [8,12] [ "-dlinear-core-lint" ]
]

isOptIntFlag :: String -> Any
Expand Down
9 changes: 9 additions & 0 deletions Cabal/Language/Haskell/Extension.hs
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,15 @@ data KnownExtension =
-- | Enable unlifted newtypes.
| UnliftedNewtypes

-- | Use whitespace to determine whether the minus sign stands for negation or subtraction.
| LexicalNegation

-- | Enable qualified do-notation desugaring.
| QualifiedDo

-- | Enable linear types.
| LinearTypes

deriving (Generic, Show, Read, Eq, Ord, Enum, Bounded, Typeable, Data)

instance Binary KnownExtension
Expand Down
30 changes: 30 additions & 0 deletions Cabal/tests/UnitTests/Distribution/Simple/Program/GHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ tests = testGroup "Distribution.Simple.Program.GHC"
options_8_8_all

assertListEquals flags options_8_8_affects

, testCase "options added in GHC-8.10" $ do
let flags :: [String]
flags = normaliseGhcArgs
Expand All @@ -27,6 +28,15 @@ tests = testGroup "Distribution.Simple.Program.GHC"
options_8_10_all

assertListEquals flags options_8_10_affects

, testCase "options added in GHC-8.12" $ do
let flags :: [String]
flags = normaliseGhcArgs
(Just $ mkVersion [8,12,1])
emptyPackageDescription
options_8_12_all

assertListEquals flags options_8_12_affects
]
]

Expand Down Expand Up @@ -140,3 +150,23 @@ options_8_10_affects =
, "-include-cpp-deps"
, "-optcxx"
]

-------------------------------------------------------------------------------
-- GHC-8.12
-------------------------------------------------------------------------------

options_8_12_all :: [String]
options_8_12_all =
[ "-ddump-cmm-opt"
, "-ddump-cpranal"
, "-ddump-cpr-signatures"
, "-ddump-hie"
-- NOTE: we filter out -dlinear-core-lint
-- we filter, -dcore-lint, -dstg-lint etc.
, "-dlinear-core-lint"
] ++ options_8_12_affects

options_8_12_affects :: [String]
options_8_12_affects =
[ "-fcmm-static-pred"
]
4 changes: 2 additions & 2 deletions Cabal/tests/UnitTests/Distribution/Utils/Structured.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tests = testGroup "Distribution.Utils.Structured"
, testCase "SPDX.License" $ structureHash (Proxy :: Proxy License) @?= md5FromInteger 0xd3d4a09f517f9f75bc3d16370d5a853a
-- The difference is in encoding of newtypes
#if MIN_VERSION_base(4,7,0)
, testCase "GenericPackageDescription" $ structureHash (Proxy :: Proxy GenericPackageDescription) @?= md5FromInteger 0xc3fd68379b7d09c2e3f751d10dde4fd6
, testCase "LocalBuildInfo" $ structureHash (Proxy :: Proxy LocalBuildInfo) @?= md5FromInteger 0x54cdbbfa6df9a9fb2c6d792d1d77d672
, testCase "GenericPackageDescription" $ structureHash (Proxy :: Proxy GenericPackageDescription) @?= md5FromInteger 0x2f869c09d0cd2288d55b0455830e5a61
, testCase "LocalBuildInfo" $ structureHash (Proxy :: Proxy LocalBuildInfo) @?= md5FromInteger 0x2d64c99467083bef4a894162a121c467
#endif
]
1 change: 1 addition & 0 deletions cabal-install/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,7 @@ planPackages verbosity comp platform solver SolverSettings{..}
-- TODO: long-term, this compatibility matrix should be
-- stored as a field inside 'Distribution.Compiler.Compiler'
setupMinCabalVersionConstraint
| isGHC, compVer >= mkVersion [8,12] = mkVersion [3,4]
| isGHC, compVer >= mkVersion [8,10] = mkVersion [3,2]
| isGHC, compVer >= mkVersion [8,8] = mkVersion [3,0]
| isGHC, compVer >= mkVersion [8,6] = mkVersion [2,4]
Expand Down