Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
-
2157db2d
by sterni at 2025-08-08T15:32:39-04:00
-
b3c31488
by David Feuer at 2025-08-08T15:33:21-04:00
-
129c9fa1
by Sylvain Henry at 2025-08-10T16:40:21-04:00
-
593cb612
by J. Ryan Stinnett at 2025-08-10T16:40:24-04:00
-
464c54b8
by J. Ryan Stinnett at 2025-08-10T16:40:24-04:00
14 changed files:
- compiler/GHC/Cmm/CommonBlockElim.hs
- docs/users_guide/conf.py
- docs/users_guide/expected-undocumented-flags.txt
- docs/users_guide/exts/doandifthenelse.rst
- + docs/users_guide/exts/relaxed_poly_rec.rst
- docs/users_guide/exts/types.rst
- hadrian/src/Settings/Default.hs
- hadrian/src/Settings/Packages.hs
- libraries/ghc-internal/src/GHC/Internal/TH/Quote.hs
- libraries/template-haskell/Language/Haskell/TH/Quote.hs
- libraries/template-haskell/changelog.md
- testsuite/tests/interface-stability/template-haskell-exports.stdout
- + testsuite/tests/numeric/should_compile/T26229.hs
- testsuite/tests/numeric/should_compile/all.T
Changes:
| ... | ... | @@ -29,6 +29,7 @@ import GHC.Utils.Word64 (truncateWord64ToWord32) |
| 29 | 29 | import Control.Arrow (first, second)
|
| 30 | 30 | import Data.List.NonEmpty (NonEmpty (..))
|
| 31 | 31 | import qualified Data.List.NonEmpty as NE
|
| 32 | +import GHC.Real (infinity,notANumber)
|
|
| 32 | 33 | |
| 33 | 34 | -- -----------------------------------------------------------------------------
|
| 34 | 35 | -- Eliminate common blocks
|
| ... | ... | @@ -167,7 +168,12 @@ hash_block block = |
| 167 | 168 | |
| 168 | 169 | hash_lit :: CmmLit -> Word32
|
| 169 | 170 | hash_lit (CmmInt i _) = fromInteger i
|
| 170 | - hash_lit (CmmFloat r _) = truncate r
|
|
| 171 | + hash_lit (CmmFloat r _)
|
|
| 172 | + -- handle these special cases as `truncate` fails on non-fractional numbers (#26229)
|
|
| 173 | + | r == infinity = 9999999
|
|
| 174 | + | r == -infinity = 9999998
|
|
| 175 | + | r == notANumber = 6666666
|
|
| 176 | + | otherwise = truncate r
|
|
| 171 | 177 | hash_lit (CmmVec ls) = hash_list hash_lit ls
|
| 172 | 178 | hash_lit (CmmLabel _) = 119 -- ugh
|
| 173 | 179 | hash_lit (CmmLabelOff _ i) = cvt $ 199 + i
|
| ... | ... | @@ -35,8 +35,6 @@ nitpick_ignore = [ |
| 35 | 35 | ("envvar", "TMPDIR"),
|
| 36 | 36 | |
| 37 | 37 | ("c:type", "bool"),
|
| 38 | - |
|
| 39 | - ("extension", "RelaxedPolyRec"),
|
|
| 40 | 38 | ]
|
| 41 | 39 | |
| 42 | 40 | rst_prolog = """
|
| ... | ... | @@ -14,7 +14,6 @@ |
| 14 | 14 | -XPolymorphicComponents
|
| 15 | 15 | -XRecordPuns
|
| 16 | 16 | -XRelaxedLayout
|
| 17 | --XRelaxedPolyRec
|
|
| 18 | 17 | -copy-libs-when-linking
|
| 19 | 18 | -dannot-lint
|
| 20 | 19 | -dppr-ticks
|
| ... | ... | @@ -8,7 +8,7 @@ Do And If Then Else |
| 8 | 8 | |
| 9 | 9 | :since: 7.0.1
|
| 10 | 10 | |
| 11 | - :status: Included in :extension:`Haskell2010`
|
|
| 11 | + :status: Included in :extension:`GHC2024`, :extension:`GHC2021`, :extension:`Haskell2010`
|
|
| 12 | 12 | |
| 13 | 13 | Allow semicolons in ``if`` expressions.
|
| 14 | 14 |
| 1 | +.. _relaxed-poly-rec:
|
|
| 2 | + |
|
| 3 | +Generalised typing of mutually recursive bindings
|
|
| 4 | +-------------------------------------------------
|
|
| 5 | + |
|
| 6 | +.. extension:: RelaxedPolyRec
|
|
| 7 | + :shortdesc: Generalised typing of mutually recursive bindings.
|
|
| 8 | + |
|
| 9 | + :since: 6.8.1
|
|
| 10 | + |
|
| 11 | + :status: Included in :extension:`GHC2024`, :extension:`GHC2021`, :extension:`Haskell2010`
|
|
| 12 | + |
|
| 13 | +See :ref:`infelicities-recursive-groups` for a description of this extension.
|
|
| 14 | +This is a long-standing GHC extension. Around the time of GHC 7.6.3, this
|
|
| 15 | +extension became required as part of a typechecker refactoring.
|
|
| 16 | +The ``-XRelaxedPolyRec`` flag is now deprecated (since the feature is always
|
|
| 17 | +enabled) and may be removed at some future time. |
| ... | ... | @@ -30,3 +30,4 @@ Types |
| 30 | 30 | type_errors
|
| 31 | 31 | defer_type_errors
|
| 32 | 32 | roles
|
| 33 | + relaxed_poly_rec |
| ... | ... | @@ -80,6 +80,7 @@ stageBootPackages = return |
| 80 | 80 | stage0Packages :: Action [Package]
|
| 81 | 81 | stage0Packages = do
|
| 82 | 82 | cross <- flag CrossCompiling
|
| 83 | + haveCurses <- any (/= "") <$> traverse setting [ CursesIncludeDir, CursesLibDir ]
|
|
| 83 | 84 | return $ [ cabalSyntax
|
| 84 | 85 | , cabal
|
| 85 | 86 | , compiler
|
| ... | ... | @@ -116,8 +117,8 @@ stage0Packages = do |
| 116 | 117 | -- that confused Hadrian, so we must make those a stage0 package as well.
|
| 117 | 118 | -- Once we drop `Win32`/`unix` it should be possible to drop those too.
|
| 118 | 119 | ]
|
| 119 | - ++ [ terminfo | not windowsHost, not cross ]
|
|
| 120 | - ++ [ timeout | windowsHost ]
|
|
| 120 | + ++ [ terminfo | not windowsHost, (not cross || haveCurses) ]
|
|
| 121 | + ++ [ timeout | windowsHost ]
|
|
| 121 | 122 | |
| 122 | 123 | -- | Packages built in 'Stage1' by default. You can change this in "UserSettings".
|
| 123 | 124 | stage1Packages :: Action [Package]
|
| ... | ... | @@ -24,6 +24,7 @@ packageArgs = do |
| 24 | 24 | -- immediately and may lead to cyclic dependencies.
|
| 25 | 25 | -- See: https://gitlab.haskell.org/ghc/ghc/issues/16809.
|
| 26 | 26 | cross = flag CrossCompiling
|
| 27 | + haveCurses = any (/= "") <$> traverse setting [ CursesIncludeDir, CursesLibDir ]
|
|
| 27 | 28 | |
| 28 | 29 | -- Check if the bootstrap compiler has the same version as the one we
|
| 29 | 30 | -- are building. This is used to build cross-compilers
|
| ... | ... | @@ -85,7 +86,7 @@ packageArgs = do |
| 85 | 86 | -- backends at the moment, so we might as well disable it
|
| 86 | 87 | -- for cross GHC.
|
| 87 | 88 | [ andM [expr (ghcWithInterpreter stage), notCross] `cabalFlag` "internal-interpreter"
|
| 88 | - , notM cross `cabalFlag` "terminfo"
|
|
| 89 | + , orM [ notM cross, haveCurses ] `cabalFlag` "terminfo"
|
|
| 89 | 90 | , arg "-build-tool-depends"
|
| 90 | 91 | , flag UseLibzstd `cabalFlag` "with-libzstd"
|
| 91 | 92 | -- ROMES: While the boot compiler is not updated wrt -this-unit-id
|
| ... | ... | @@ -120,7 +121,7 @@ packageArgs = do |
| 120 | 121 | |
| 121 | 122 | -------------------------------- ghcPkg --------------------------------
|
| 122 | 123 | , package ghcPkg ?
|
| 123 | - builder (Cabal Flags) ? notM cross `cabalFlag` "terminfo"
|
|
| 124 | + builder (Cabal Flags) ? orM [ notM cross, haveCurses ] `cabalFlag` "terminfo"
|
|
| 124 | 125 | |
| 125 | 126 | -------------------------------- ghcBoot ------------------------------
|
| 126 | 127 | , package ghcBoot ?
|
| ... | ... | @@ -202,10 +203,10 @@ packageArgs = do |
| 202 | 203 | , package haskeline ?
|
| 203 | 204 | builder (Cabal Flags) ? arg "-examples"
|
| 204 | 205 | -- Don't depend upon terminfo when cross-compiling to avoid unnecessary
|
| 205 | - -- dependencies.
|
|
| 206 | - -- TODO: Perhaps the user should rather be responsible for this?
|
|
| 206 | + -- dependencies unless the user provided ncurses explicitly.
|
|
| 207 | + -- TODO: Perhaps the user should be able to explicitly enable/disable this.
|
|
| 207 | 208 | , package haskeline ?
|
| 208 | - builder (Cabal Flags) ? notM cross `cabalFlag` "terminfo"
|
|
| 209 | + builder (Cabal Flags) ? orM [ notM cross, haveCurses ] `cabalFlag` "terminfo"
|
|
| 209 | 210 | |
| 210 | 211 | -------------------------------- terminfo ------------------------------
|
| 211 | 212 | , package terminfo ?
|
| ... | ... | @@ -26,10 +26,10 @@ import GHC.Internal.Base hiding (Type) |
| 26 | 26 | -- | The 'QuasiQuoter' type, a value @q@ of this type can be used
|
| 27 | 27 | -- in the syntax @[q| ... string to parse ...|]@. In fact, for
|
| 28 | 28 | -- convenience, a 'QuasiQuoter' actually defines multiple quasiquoters
|
| 29 | --- to be used in different splice contexts; if you are only interested
|
|
| 30 | --- in defining a quasiquoter to be used for expressions, you would
|
|
| 31 | --- define a 'QuasiQuoter' with only 'quoteExp', and leave the other
|
|
| 32 | --- fields stubbed out with errors.
|
|
| 29 | +-- to be used in different splice contexts. In the usual case of a
|
|
| 30 | +-- @QuasiQuoter@ that is only intended to be used in certain splice
|
|
| 31 | +-- contexts, the unused fields should just 'fail'. This is most easily
|
|
| 32 | +-- accomplished using 'namedefaultQuasiQuoter' or 'defaultQuasiQuoter'.
|
|
| 33 | 33 | data QuasiQuoter = QuasiQuoter {
|
| 34 | 34 | -- | Quasi-quoter for expressions, invoked by quotes like @lhs = $[q|...]@
|
| 35 | 35 | quoteExp :: String -> Q Exp,
|
| ... | ... | @@ -16,6 +16,8 @@ that is up to you. |
| 16 | 16 | module Language.Haskell.TH.Quote
|
| 17 | 17 | ( QuasiQuoter(..)
|
| 18 | 18 | , quoteFile
|
| 19 | + , namedDefaultQuasiQuoter
|
|
| 20 | + , defaultQuasiQuoter
|
|
| 19 | 21 | -- * For backwards compatibility
|
| 20 | 22 | ,dataToQa, dataToExpQ, dataToPatQ
|
| 21 | 23 | ) where
|
| ... | ... | @@ -39,3 +41,54 @@ quoteFile (QuasiQuoter { quoteExp = qe, quotePat = qp, quoteType = qt, quoteDec |
| 39 | 41 | get old_quoter file_name = do { file_cts <- runIO (readFile file_name)
|
| 40 | 42 | ; addDependentFile file_name
|
| 41 | 43 | ; old_quoter file_cts }
|
| 44 | + |
|
| 45 | +-- | A 'QuasiQuoter' that fails with a helpful error message in every
|
|
| 46 | +-- context. It is intended to be modified to create a 'QuasiQuoter' that
|
|
| 47 | +-- fails in all inappropriate contexts.
|
|
| 48 | +--
|
|
| 49 | +-- For example, you could write
|
|
| 50 | +--
|
|
| 51 | +-- @
|
|
| 52 | +-- myPatQQ = (namedDefaultQuasiQuoter "myPatQQ")
|
|
| 53 | +-- { quotePat = ... }
|
|
| 54 | +-- @
|
|
| 55 | +--
|
|
| 56 | +-- If 'myPatQQ' is used in an expression context, the compiler will report
|
|
| 57 | +-- that, naming 'myPatQQ'.
|
|
| 58 | +--
|
|
| 59 | +-- See also 'defaultQuasiQuoter', which does not name the 'QuasiQuoter' in
|
|
| 60 | +-- the error message, and might therefore be more appropriate when
|
|
| 61 | +-- the users of a particular 'QuasiQuoter' tend to define local \"synonyms\"
|
|
| 62 | +-- for it.
|
|
| 63 | +namedDefaultQuasiQuoter :: String -> QuasiQuoter
|
|
| 64 | +namedDefaultQuasiQuoter name = QuasiQuoter
|
|
| 65 | + { quoteExp = f "use in expression contexts."
|
|
| 66 | + , quotePat = f "use in pattern contexts."
|
|
| 67 | + , quoteType = f "use in types."
|
|
| 68 | + , quoteDec = f "creating declarations."
|
|
| 69 | + }
|
|
| 70 | + where
|
|
| 71 | + f m _ = fail $ "The " ++ name ++ " quasiquoter is not for " ++ m
|
|
| 72 | + |
|
| 73 | +-- | A 'QuasiQuoter' that fails with a helpful error message in every
|
|
| 74 | +-- context. It is intended to be modified to create a 'QuasiQuoter' that
|
|
| 75 | +-- fails in all inappropriate contexts.
|
|
| 76 | +--
|
|
| 77 | +-- For example, you could write
|
|
| 78 | +--
|
|
| 79 | +-- @
|
|
| 80 | +-- myExpressionQQ = defaultQuasiQuoter
|
|
| 81 | +-- { quoteExp = ... }
|
|
| 82 | +-- @
|
|
| 83 | +--
|
|
| 84 | +-- See also 'namedDefaultQuasiQuoter', which names the 'QuasiQuoter' in the
|
|
| 85 | +-- error messages.
|
|
| 86 | +defaultQuasiQuoter :: QuasiQuoter
|
|
| 87 | +defaultQuasiQuoter = QuasiQuoter
|
|
| 88 | + { quoteExp = f "use in expression contexts."
|
|
| 89 | + , quotePat = f "use in pattern contexts."
|
|
| 90 | + , quoteType = f "use in types."
|
|
| 91 | + , quoteDec = f "creating declarations."
|
|
| 92 | + }
|
|
| 93 | + where
|
|
| 94 | + f m _ = fail $ "This quasiquoter is not for " ++ m |
| 1 | 1 | # Changelog for [`template-haskell` package](http://hackage.haskell.org/package/template-haskell)
|
| 2 | 2 | |
| 3 | +## 2.25.0.0
|
|
| 4 | + * Introduce `namedDefaultQuasiQuoter` and `defaultQuasiQuoter`, which fail with a helpful error when used in an inappropriate context.
|
|
| 5 | + |
|
| 3 | 6 | ## 2.24.0.0
|
| 4 | 7 | |
| 5 | 8 | * Introduce `dataToCodeQ` and `liftDataTyped`, typed variants of `dataToExpQ` and `liftData` respectively.
|
| ... | ... | @@ -1370,6 +1370,8 @@ module Language.Haskell.TH.Quote where |
| 1370 | 1370 | dataToExpQ :: forall (m :: * -> *) a. (GHC.Internal.TH.Syntax.Quote m, GHC.Internal.Data.Data.Data a) => (forall b. GHC.Internal.Data.Data.Data b => b -> GHC.Internal.Maybe.Maybe (m GHC.Internal.TH.Syntax.Exp)) -> a -> m GHC.Internal.TH.Syntax.Exp
|
| 1371 | 1371 | dataToPatQ :: forall (m :: * -> *) a. (GHC.Internal.TH.Syntax.Quote m, GHC.Internal.Data.Data.Data a) => (forall b. GHC.Internal.Data.Data.Data b => b -> GHC.Internal.Maybe.Maybe (m GHC.Internal.TH.Syntax.Pat)) -> a -> m GHC.Internal.TH.Syntax.Pat
|
| 1372 | 1372 | dataToQa :: forall (m :: * -> *) a k q. (GHC.Internal.TH.Syntax.Quote m, GHC.Internal.Data.Data.Data a) => (GHC.Internal.TH.Syntax.Name -> k) -> (GHC.Internal.TH.Syntax.Lit -> m q) -> (k -> [m q] -> m q) -> (forall b. GHC.Internal.Data.Data.Data b => b -> GHC.Internal.Maybe.Maybe (m q)) -> a -> m q
|
| 1373 | + defaultQuasiQuoter :: QuasiQuoter
|
|
| 1374 | + namedDefaultQuasiQuoter :: GHC.Internal.Base.String -> QuasiQuoter
|
|
| 1373 | 1375 | quoteFile :: QuasiQuoter -> QuasiQuoter
|
| 1374 | 1376 | |
| 1375 | 1377 | module Language.Haskell.TH.Syntax where
|
| ... | ... | @@ -1720,8 +1722,8 @@ module Language.Haskell.TH.Syntax where |
| 1720 | 1722 | qAddForeignFilePath :: ForeignSrcLang -> GHC.Internal.Base.String -> m ()
|
| 1721 | 1723 | qAddModFinalizer :: Q () -> m ()
|
| 1722 | 1724 | qAddCorePlugin :: GHC.Internal.Base.String -> m ()
|
| 1723 | - qGetQ :: forall a. ghc-internal-9.1300.0:GHC.Internal.Data.Typeable.Internal.Typeable a => m (GHC.Internal.Maybe.Maybe a)
|
|
| 1724 | - qPutQ :: forall a. ghc-internal-9.1300.0:GHC.Internal.Data.Typeable.Internal.Typeable a => a -> m ()
|
|
| 1725 | + qGetQ :: forall a. ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a => m (GHC.Internal.Maybe.Maybe a)
|
|
| 1726 | + qPutQ :: forall a. ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a => a -> m ()
|
|
| 1725 | 1727 | qIsExtEnabled :: Extension -> m GHC.Internal.Types.Bool
|
| 1726 | 1728 | qExtsEnabled :: m [Extension]
|
| 1727 | 1729 | qPutDoc :: DocLoc -> GHC.Internal.Base.String -> m ()
|
| ... | ... | @@ -1802,7 +1804,7 @@ module Language.Haskell.TH.Syntax where |
| 1802 | 1804 | falseName :: Name
|
| 1803 | 1805 | getDoc :: DocLoc -> Q (GHC.Internal.Maybe.Maybe GHC.Internal.Base.String)
|
| 1804 | 1806 | getPackageRoot :: Q GHC.Internal.IO.FilePath
|
| 1805 | - getQ :: forall a. ghc-internal-9.1300.0:GHC.Internal.Data.Typeable.Internal.Typeable a => Q (GHC.Internal.Maybe.Maybe a)
|
|
| 1807 | + getQ :: forall a. ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a => Q (GHC.Internal.Maybe.Maybe a)
|
|
| 1806 | 1808 | get_cons_names :: Con -> [Name]
|
| 1807 | 1809 | hoistCode :: forall (m :: * -> *) (n :: * -> *) (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). GHC.Internal.Base.Monad m => (forall x. m x -> n x) -> Code m a -> Code n a
|
| 1808 | 1810 | isExtEnabled :: Extension -> Q GHC.Internal.Types.Bool
|
| ... | ... | @@ -1849,7 +1851,7 @@ module Language.Haskell.TH.Syntax where |
| 1849 | 1851 | oneName :: Name
|
| 1850 | 1852 | pkgString :: PkgName -> GHC.Internal.Base.String
|
| 1851 | 1853 | putDoc :: DocLoc -> GHC.Internal.Base.String -> Q ()
|
| 1852 | - putQ :: forall a. ghc-internal-9.1300.0:GHC.Internal.Data.Typeable.Internal.Typeable a => a -> Q ()
|
|
| 1854 | + putQ :: forall a. ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a => a -> Q ()
|
|
| 1853 | 1855 | recover :: forall a. Q a -> Q a -> Q a
|
| 1854 | 1856 | reify :: Name -> Q Info
|
| 1855 | 1857 | reifyAnnotations :: forall a. GHC.Internal.Data.Data.Data a => AnnLookup -> Q [a]
|
| 1 | +{-# LANGUAGE NegativeLiterals #-}
|
|
| 2 | + |
|
| 3 | +module T26229 where
|
|
| 4 | + |
|
| 5 | +sqrte2pqiq :: (Floating a, Ord a) => a -> a -> a
|
|
| 6 | +sqrte2pqiq e qiq -- = sqrt (e*e + qiq)
|
|
| 7 | + | e < - 1.5097698010472593e153 = -(qiq/e) - e
|
|
| 8 | + | e < 5.582399551122541e57 = sqrt (e*e + qiq) -- test Infinity#
|
|
| 9 | + | e < -5.582399551122541e57 = -sqrt (e*e + qiq) -- test -Infinity#
|
|
| 10 | + | otherwise = (qiq/e) + e
|
|
| 11 | +{-# SPECIALIZE sqrte2pqiq :: Double -> Double -> Double #-}
|
|
| 12 | +{-# SPECIALIZE sqrte2pqiq :: Float -> Float -> Float #-} |
| ... | ... | @@ -22,3 +22,4 @@ test('T15547', normal, compile, ['-ddump-simpl -O -dsuppress-all -dno-typeable-b |
| 22 | 22 | test('T23019', normal, compile, ['-O'])
|
| 23 | 23 | test('T23907', [ when(wordsize(32), expect_broken(23908))], compile, ['-ddump-simpl -O2 -dsuppress-all -dno-typeable-binds -dsuppress-uniques'])
|
| 24 | 24 | test('T24331', normal, compile, ['-O -ddump-simpl -dsuppress-all -dsuppress-uniques -dno-typeable-binds'])
|
| 25 | +test('T26229', normal, compile, ['-O2']) |