[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 7 commits: compiler: Fix pretty printing of ticked prefix constructors (#24237)

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Wed Aug 21 07:51:29 UTC 2024



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
5f972bfb by Zubin Duggal at 2024-08-21T03:18:15-04:00
compiler: Fix pretty printing of ticked prefix constructors (#24237)

- - - - -
ef0a08e7 by Mike Pilgrem at 2024-08-21T03:18:57-04:00
Fix #15773 Clarify further -rtsopts 'defaults' in docs

- - - - -
05a4be58 by Sebastian Graf at 2024-08-21T03:19:33-04:00
Improve efficiency of `assertError` (#24625)

... by moving `lazy` to the exception-throwing branch.
It's all documented in `Note [Strictness of assertError]`.

- - - - -
a0d93ff3 by sheaf at 2024-08-21T03:50:49-04:00
GHCi debugger: drop record name spaces for Ids

When binding new local variables at a breakpoint, we should create
Ids with variable namespace, and not record field namespace. Otherwise
the rest of the compiler falls over because the IdDetails are wrong.

Fixes #25109

- - - - -
c684da75 by Hécate Kleidukos at 2024-08-21T03:50:55-04:00
base: Final deprecation of GHC.Pack

The timeline mandated by #21461 has come to its term and after two years
and four minor releases, we are finally removing GHC.Pack from base.

Closes #21536

- - - - -
015b47f8 by Sylvain Henry at 2024-08-21T03:51:08-04:00
JS: support rubbish static literals (#25177)

Support for rubbish dynamic literals was added in #24664. This patch
does the same for static literals.

Fix #25177

- - - - -
4f08f0de by Phil de Joux at 2024-08-21T03:51:13-04:00
haddock docs: prefix comes before, postfix comes after

- - - - -


29 changed files:

- + a.out
- compiler/GHC/Iface/Type.hs
- compiler/GHC/Runtime/Eval.hs
- compiler/GHC/StgToJS/Literal.hs
- compiler/GHC/Types/Id.hs
- docs/users_guide/9.12.1-notes.rst
- docs/users_guide/phases.rst
- libraries/base/base.cabal
- libraries/base/changelog.md
- − libraries/base/src/GHC/Pack.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Exception.hs
- + testsuite/tests/codeGen/should_compile/T25177.hs
- + testsuite/tests/codeGen/should_compile/T25177.stderr
- testsuite/tests/codeGen/should_compile/all.T
- + testsuite/tests/ghci.debugger/scripts/T25109.hs
- + testsuite/tests/ghci.debugger/scripts/T25109.script
- + testsuite/tests/ghci.debugger/scripts/T25109.stdout
- testsuite/tests/ghci.debugger/scripts/all.T
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32
- + testsuite/tests/printer/T24237.hs
- + testsuite/tests/printer/T24237.stderr
- testsuite/tests/printer/all.T
- + testsuite/tests/simplCore/should_compile/T24625.hs
- testsuite/tests/simplCore/should_compile/all.T
- utils/haddock/doc/common-errors.rst
- utils/haddock/doc/markup.rst


Changes:

=====================================
a.out
=====================================
Binary files /dev/null and b/a.out differ


=====================================
compiler/GHC/Iface/Type.hs
=====================================
@@ -1847,17 +1847,16 @@ ppr_iface_tc_app pp ctxt_prec tc tys =
      | tc `ifaceTyConHasKey` liftedTypeKindTyConKey
      -> ppr_kind_type ctxt_prec
 
-     | not (isSymOcc (nameOccName (ifaceTyConName tc)))
-     -> pprIfacePrefixApp ctxt_prec (ppr tc) (map (pp appPrec) tys)
+     | isSymOcc (nameOccName (ifaceTyConName tc))
 
-     | [ ty1@(_, Required), ty2@(_, Required) ] <- tys
+     , [ ty1@(_, Required), ty2@(_, Required) ] <- tys
          -- Infix, two visible arguments (we know nothing of precedence though).
          -- Don't apply this special case if one of the arguments is invisible,
          -- lest we print something like (@LiftedRep -> @LiftedRep) (#15941).
-     -> pprIfaceInfixApp ctxt_prec (ppr tc) (pp opPrec ty1) (pp opPrec ty2)
+     -> pprIfaceInfixApp ctxt_prec (pprIfaceTyCon tc) (pp opPrec ty1) (pp opPrec ty2)
 
      | otherwise
-     -> pprIfacePrefixApp ctxt_prec (parens (ppr tc)) (map (pp appPrec) tys)
+     -> pprIfacePrefixApp ctxt_prec (pprParendIfaceTyCon tc) (map (pp appPrec) tys)
 
 data TupleOrSum = IsSum | IsTuple TupleSort
   deriving (Eq)
@@ -2070,7 +2069,18 @@ instance Outputable IfLclName where
   ppr = ppr . ifLclNameFS
 
 instance Outputable IfaceTyCon where
-  ppr tc = pprPromotionQuote tc <> ppr (ifaceTyConName tc)
+  ppr = pprIfaceTyCon
+
+-- | Print an `IfaceTyCon` with a promotion tick if needed, without parens,
+-- suitable for use in infix contexts
+pprIfaceTyCon :: IfaceTyCon -> SDoc
+pprIfaceTyCon tc = pprPromotionQuote tc <> ppr (ifaceTyConName tc)
+
+-- | Print an `IfaceTyCon` with a promotion tick if needed, possibly with parens,
+-- suitable for use in prefix contexts
+pprParendIfaceTyCon :: IfaceTyCon -> SDoc
+pprParendIfaceTyCon tc = pprPromotionQuote tc <> pprPrefixVar (isSymOcc (nameOccName tc_name)) (ppr tc_name)
+  where tc_name = ifaceTyConName tc
 
 instance Outputable IfaceTyConInfo where
   ppr (IfaceTyConInfo { ifaceTyConIsPromoted = prom


=====================================
compiler/GHC/Runtime/Eval.hs
=====================================
@@ -625,8 +625,10 @@ bindLocalsAtBreakpoint hsc_env apStack_fhv (Just ibi) = do
         -- saved/restored, but not the linker state.  See #1743, test break026.
    mkNewId :: OccName -> Type -> Id -> IO Id
    mkNewId occ ty old_id
-     = do { name <- newInteractiveBinder hsc_env occ (getSrcSpan old_id)
-          ; return (Id.mkVanillaGlobalWithInfo name ty (idInfo old_id)) }
+     = do { name <- newInteractiveBinder hsc_env (mkVarOccFS (occNameFS occ)) (getSrcSpan old_id)
+              -- NB: use variable namespace.
+              -- Don't use record field namespaces, lest we cause #25109.
+          ; return $ Id.mkVanillaGlobalWithInfo name ty (idInfo old_id) }
 
    newTyVars :: UniqSupply -> [TcTyVar] -> Subst
      -- Similarly, clone the type variables mentioned in the types


=====================================
compiler/GHC/StgToJS/Literal.hs
=====================================
@@ -115,7 +115,24 @@ genStaticLit = \case
   LitDouble r              -> return [ DoubleLit . SaneDouble . r2d $ r ]
   LitLabel name fod        -> return [ LabelLit (fod == IsFunction) (mkRawSymbol True name)
                                      , IntLit 0 ]
-  l -> pprPanic "genStaticLit" (ppr l)
+  LitRubbish _ rep ->
+    let prim_reps = runtimeRepPrimRep (text "GHC.StgToJS.Literal.genStaticLit") rep
+    in case expectOnly "GHC.StgToJS.Literal.genStaticLit" prim_reps of -- Note [Post-unarisation invariants]
+        BoxedRep _  -> pure [ NullLit ]
+        AddrRep     -> pure [ NullLit, IntLit 0 ]
+        IntRep      -> pure [ IntLit 0 ]
+        Int8Rep     -> pure [ IntLit 0 ]
+        Int16Rep    -> pure [ IntLit 0 ]
+        Int32Rep    -> pure [ IntLit 0 ]
+        Int64Rep    -> pure [ IntLit 0, IntLit 0 ]
+        WordRep     -> pure [ IntLit 0 ]
+        Word8Rep    -> pure [ IntLit 0 ]
+        Word16Rep   -> pure [ IntLit 0 ]
+        Word32Rep   -> pure [ IntLit 0 ]
+        Word64Rep   -> pure [ IntLit 0, IntLit 0 ]
+        FloatRep    -> pure [ DoubleLit (SaneDouble 0) ]
+        DoubleRep   -> pure [ DoubleLit (SaneDouble 0) ]
+        VecRep {}   -> pprPanic "GHC.StgToJS.Literal.genStaticLit: LitRubbish(VecRep) isn't supported" (ppr rep)
 
 -- make an unsigned 32 bit number from this unsigned one, lower 32 bits
 toU32Expr :: Integer -> JStgExpr


=====================================
compiler/GHC/Types/Id.hs
=====================================
@@ -301,26 +301,28 @@ mkGlobalId :: IdDetails -> Name -> Type -> IdInfo -> Id
 mkGlobalId = Var.mkGlobalVar
 
 -- | Make a global 'Id' without any extra information at all
-mkVanillaGlobal :: Name -> Type -> Id
+mkVanillaGlobal :: HasDebugCallStack => Name -> Type -> Id
 mkVanillaGlobal name ty = mkVanillaGlobalWithInfo name ty vanillaIdInfo
 
 -- | Make a global 'Id' with no global information but some generic 'IdInfo'
-mkVanillaGlobalWithInfo :: Name -> Type -> IdInfo -> Id
-mkVanillaGlobalWithInfo = mkGlobalId VanillaId
-
+mkVanillaGlobalWithInfo :: HasDebugCallStack => Name -> Type -> IdInfo -> Id
+mkVanillaGlobalWithInfo nm =
+  assertPpr (not $ isFieldNameSpace $ nameNameSpace nm)
+    (text "mkVanillaGlobalWithInfo called on record field:" <+> ppr nm) $
+    mkGlobalId VanillaId nm
 
 -- | For an explanation of global vs. local 'Id's, see "GHC.Types.Var#globalvslocal"
 mkLocalId :: HasDebugCallStack => Name -> Mult -> Type -> Id
 mkLocalId name w ty = mkLocalIdWithInfo name w (assert (not (isCoVarType ty)) ty) vanillaIdInfo
 
 -- | Make a local CoVar
-mkLocalCoVar :: Name -> Type -> CoVar
+mkLocalCoVar :: HasDebugCallStack => Name -> Type -> CoVar
 mkLocalCoVar name ty
   = assert (isCoVarType ty) $
     Var.mkLocalVar CoVarId name ManyTy ty vanillaIdInfo
 
 -- | Like 'mkLocalId', but checks the type to see if it should make a covar
-mkLocalIdOrCoVar :: Name -> Mult -> Type -> Id
+mkLocalIdOrCoVar :: HasDebugCallStack => Name -> Mult -> Type -> Id
 mkLocalIdOrCoVar name w ty
   -- We should assert (eqType w Many) in the isCoVarType case.
   -- However, currently this assertion does not hold.
@@ -344,7 +346,10 @@ mkExportedLocalId details name ty = Var.mkExportedLocalVar details name ty vanil
         -- Note [Free type variables]
 
 mkExportedVanillaId :: Name -> Type -> Id
-mkExportedVanillaId name ty = Var.mkExportedLocalVar VanillaId name ty vanillaIdInfo
+mkExportedVanillaId name ty =
+  assertPpr (not $ isFieldNameSpace $ nameNameSpace name)
+    (text "mkExportedVanillaId called on record field:" <+> ppr name) $
+    Var.mkExportedLocalVar VanillaId name ty vanillaIdInfo
         -- Note [Free type variables]
 
 


=====================================
docs/users_guide/9.12.1-notes.rst
=====================================
@@ -157,6 +157,7 @@ Runtime system
   https://github.com/haskell/core-libraries-committee/issues/231
   https://github.com/haskell/core-libraries-committee/issues/261
 
+- The `deprecation process of GHC.Pack <https://gitlab.haskell.org/ghc/ghc/-/issues/21461>` has come its term. The module has now been removed from ``base``.
 
 ``ghc-prim`` library
 ~~~~~~~~~~~~~~~~~~~~


=====================================
docs/users_guide/phases.rst
=====================================
@@ -1151,8 +1151,9 @@ for example).
     :shortdesc: Control whether the RTS behaviour can be tweaked via command-line
         flags and the ``GHCRTS`` environment variable. Using ``none``
         means no RTS flags can be given; ``some`` means only a minimum
-        of safe options can be given (the default); ``all`` (or no
-        argument at all) means that all RTS flags are permitted; ``ignore``
+        of safe options can be given (the default, if ``-rtsopts`` is
+        not passed); ``all`` means that all RTS flags are permitted (the
+        default, if ``-rtsopts`` is passed with no argument); ``ignore``
         means RTS flags can be given, but are treated as regular arguments and
         passed to the Haskell program as arguments; ``ignoreAll`` is the same as
         ``ignore``, but ``GHCRTS`` is also ignored. ``-rtsopts`` does not
@@ -1161,11 +1162,12 @@ for example).
     :type: dynamic
     :category: linking
 
-    :default: some
+    :default: ``some``, if ``-rtsopts`` is not passed; ``all``, if ``-rtsopts``
+        is passed with no argument.
 
     This option affects the processing of RTS control options given
     either on the command line or via the :envvar:`GHCRTS` environment
-    variable. There are five possibilities:
+    variable. There are six possibilities:
 
     ``-rtsopts=none``
         Disable all processing of RTS options. If ``+RTS`` appears
@@ -1181,18 +1183,22 @@ for example).
         ``GHCRTS`` options will be processed normally.
 
     ``-rtsopts=ignoreAll``
-        Same as ``ignore`` but also ignores ``GHCRTS``.
+        Same as ``ignore`` with the exception of ``GHCRTS`` options, which are
+        also ignored.
 
     ``-rtsopts=some``
-        [this is the default setting] Enable only the "safe" RTS
-        options: (Currently only ``-?`` and ``--info``.) Any other RTS
-        options on the command line or in the ``GHCRTS`` environment
-        variable causes the program with to abort with an error message.
+        [this is the default setting, if ``-rtsopts`` is not passed] Enable only
+        the "safe" RTS options: (Currently only ``-?`` and ``--info``.) Any
+        other RTS options on the command line or in the ``GHCRTS`` environment
+        variable causes the program to abort with an error message.
 
-    ``-rtsopts=all`` or just ``-rtsopts``
+    ``-rtsopts=all``
         Enable *all* RTS option processing, both on the command line and
         through the ``GHCRTS`` environment variable.
 
+    ``-rtsopts``
+        Equivalent to ``-rtsopts=all``.
+
     In GHC 6.12.3 and earlier, the default was to process all RTS
     options. However, since RTS options can be used to write logging
     data to arbitrary files under the security context of the running


=====================================
libraries/base/base.cabal
=====================================
@@ -217,7 +217,6 @@ Library
         , GHC.Num
         , GHC.OldList
         , GHC.OverloadedLabels
-        , GHC.Pack
         , GHC.Profiling
         , GHC.Ptr
         , GHC.Read


=====================================
libraries/base/changelog.md
=====================================
@@ -18,6 +18,7 @@
   * Add exception type metadata to default exception handler output.
     ([CLC proposal #231](https://github.com/haskell/core-libraries-committee/issues/231)
     and [CLC proposal #261](https://github.com/haskell/core-libraries-committee/issues/261))
+  * The [deprecation process of GHC.Pack](https://gitlab.haskell.org/ghc/ghc/-/issues/21461) has come its term. The module has now been removed from `base`.
 
 ## 4.20.0.0 May 2024
   * Shipped with GHC 9.10.1


=====================================
libraries/base/src/GHC/Pack.hs deleted
=====================================
@@ -1,37 +0,0 @@
-{-# LANGUAGE MagicHash #-}
-{-# OPTIONS_HADDOCK not-home #-}
-
--- |
---
--- Module      :  GHC.Pack
--- Copyright   :  (c) The University of Glasgow 1997-2002
--- License     :  see libraries/base/LICENSE
---
--- Maintainer  :  ghc-devs at haskell.org
--- Stability   :  internal
--- Portability :  non-portable (GHC Extensions)
---
--- ⚠ Warning: Starting @base-4.18@, this module is being deprecated.
--- See https://gitlab.haskell.org/ghc/ghc/-/issues/21461 for more information.
---
---
---
--- This module provides a small set of low-level functions for packing
--- and unpacking a chunk of bytes. Used by code emitted by the compiler
--- plus the prelude libraries.
---
--- The programmer level view of packed strings is provided by a GHC
--- system library PackedString.
---
-
-module GHC.Pack
-    {-# DEPRECATED "The exports of this module should be instead imported from GHC.Exts" #-}
-    (packCString#,
-     unpackCString,
-     unpackCString#,
-     unpackNBytes#,
-     unpackFoldrCString#,
-     unpackAppendCString#
-     ) where
-
-import GHC.Internal.Pack


=====================================
libraries/ghc-internal/src/GHC/Internal/IO/Exception.hs
=====================================
@@ -438,13 +438,10 @@ instance Show IOException where
          "" -> id
          _  -> showString " (" . showString s . showString ")")
 
--- Note the use of "lazy". This means that
---     assert False (throw e)
--- will throw the assertion failure rather than e. See trac #5561.
 assertError :: (?callStack :: CallStack) => Bool -> a -> a
 assertError predicate v
-  | predicate = lazy v
-  | otherwise = unsafeDupablePerformIO $ do
+  | predicate = v
+  | otherwise = lazy $ unsafeDupablePerformIO $ do -- lazy: See Note [Strictness of assertError]
     ccsStack <- currentCallStack
     let
       implicitParamCallStack = prettyCallStackLines ?callStack
@@ -452,6 +449,44 @@ assertError predicate v
       stack = intercalate "\n" $ implicitParamCallStack ++ ccsCallStack
     throwIO (AssertionFailed ("Assertion failed\n" ++ stack))
 
+{- Note [Strictness of assertError]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+It is vital that Demand Analysis does not see `assertError p e` as strict in e.
+#5561 details what happens otherwise, tested by libraries/base/tests/assert.hs:
+
+  let e1 i = throw Overflow
+  in assertError False (e1 5)
+
+This should *not* throw the Overflow exception; rather it should throw an
+AssertionError.
+Hence we use GHC.Exts.lazy to make assertError appear lazy in e, so that it
+is not called by-value.
+(Note that the reason we need `lazy` in the first place is that error has a
+bottoming result, which is strict in all free variables.)
+The way we achieve this is a bit subtle; before #24625 we defined it as
+
+  assertError p e | p         = lazy e
+                  | otherwise = error "assertion"
+
+but this means that in the following example (full code in T24625) we cannot
+cancel away the allocation of `Just x` because of the intervening `lazy`:
+
+  case assertError False (Just x) of Just y -> y
+  ==> { simplify }
+  case lazy (Just x) of Just y -> y
+
+Instead, we put `lazy` in the otherwise branch, thus
+
+  assertError p e | p         = e
+                  | otherwise = lazy $ error "assertion"
+
+The effect on #5561 is the same: since the otherwise branch appears lazy in e,
+the overall demand on `e` must be lazy as well.
+Furthermore, since there is no intervening `lazy` on the expected code path,
+the Simplifier may perform case-of-case on e and simplify the `Just x` example
+to `x`.
+-}
+
 unsupportedOperation :: IOError
 unsupportedOperation =
    (IOError Nothing UnsupportedOperation ""
@@ -480,4 +515,3 @@ untangle coded message
           _         -> (loc, "")
         }
     not_bar c = c /= '|'
-


=====================================
testsuite/tests/codeGen/should_compile/T25177.hs
=====================================
@@ -0,0 +1,32 @@
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE UnboxedSums #-}
+{-# LANGUAGE UnboxedTuples #-}
+
+-- only export bar!
+module T25177 (bar) where
+
+import GHC.Exts
+
+data D = D !Word# !Int#
+
+{-# OPAQUE foo #-}
+-- foo has an absent demand on D's Int#
+foo :: D -> Word
+foo (D a _) = W# a
+
+
+bar :: Int# -> IO ()
+bar !x = do
+  -- we allocate a D:
+  --  - used twice: otherwise it is inlined
+  --  - whose second arg:
+  --    - has an absent demand
+  --    - is an unboxed Int# (hence won't be replaced by an "absentError blah"
+  --    but by a LitRubbish)
+  --
+  -- GHC should detect that `17# +# x` is absent. Then it should lift `d` to the
+  -- top-level. This is checked by dumping Core with -ddump-simpl.
+  let d = D 10## (17# +# x)
+  let !r1 = foo d -- luckily CSE doesn't kick in before floating-out `d`...
+  let !r2 = foo d -- otherwise, pass a additional dummy argument to `foo`
+  pure ()


=====================================
testsuite/tests/codeGen/should_compile/T25177.stderr
=====================================
@@ -0,0 +1,17 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core
+  = {terms: 25, types: 31, coercions: 6, joins: 0/0}
+
+foo = \ ds -> case ds of { D a ds1 -> W# a }
+
+d = D 10## RUBBISH(IntRep)
+
+lvl = foo d
+
+bar1 = \ _ eta -> case lvl of { W# ipv -> (# eta, () #) }
+
+bar = bar1 `cast` <Co:6> :: ...
+
+
+


=====================================
testsuite/tests/codeGen/should_compile/all.T
=====================================
@@ -138,3 +138,6 @@ test('callee-no-local', [
   compile,
   ['-ddump-cmm-raw']
 )
+
+# dump Core to ensure that d is defined as: d = D 10## RUBBISH(IntRep)
+test('T25177', normal, compile, ['-O2 -dno-typeable-binds -ddump-simpl -dsuppress-all -dsuppress-uniques -v0'])


=====================================
testsuite/tests/ghci.debugger/scripts/T25109.hs
=====================================
@@ -0,0 +1,10 @@
+module T25109 where
+
+data R = R { fld :: Int }
+
+foo :: R -> IO ()
+foo r = case fld r of
+  !i -> print i
+
+main :: IO ()
+main = foo (R 1)


=====================================
testsuite/tests/ghci.debugger/scripts/T25109.script
=====================================
@@ -0,0 +1,7 @@
+:l T25109.hs
+:break foo
+main
+:step
+:step
+:step
+:step


=====================================
testsuite/tests/ghci.debugger/scripts/T25109.stdout
=====================================
@@ -0,0 +1,15 @@
+Breakpoint 0 activated at T25109.hs:(6,9)-(7,15)
+Stopped in T25109.foo, T25109.hs:(6,9)-(7,15)
+_result :: IO () = _
+r :: R = _
+Stopped in T25109.foo, T25109.hs:6:14-18
+_result :: Int = _
+r :: R = _
+Stopped in T25109.main, T25109.hs:10:13-15
+_result :: R = _
+Stopped in T25109.fld, T25109.hs:3:14-16
+_result :: Int = _
+fld :: Int = 1
+Stopped in T25109.foo, T25109.hs:7:9-15
+_result :: IO () = _
+i :: Int = 1


=====================================
testsuite/tests/ghci.debugger/scripts/all.T
=====================================
@@ -142,3 +142,4 @@ test('break030',
 test('T23057', [only_ghci, extra_hc_opts('-fno-break-points')], ghci_script, ['T23057.script'])
 test('T24306', normal, ghci_script, ['T24306.script'])
 test('T24712', normal, ghci_script, ['T24712.script'])
+test('T25109', normal, ghci_script, ['T25109.script'])


=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -9027,15 +9027,6 @@ module GHC.OverloadedLabels where
     fromLabel :: a
     {-# MINIMAL fromLabel #-}
 
-module GHC.Pack where
-  -- Safety: None
-  packCString# :: [GHC.Types.Char] -> GHC.Prim.ByteArray#
-  unpackAppendCString# :: GHC.Prim.Addr# -> [GHC.Types.Char] -> [GHC.Types.Char]
-  unpackCString :: forall a. GHC.Internal.Ptr.Ptr a -> [GHC.Types.Char]
-  unpackCString# :: GHC.Prim.Addr# -> [GHC.Types.Char]
-  unpackFoldrCString# :: forall a. GHC.Prim.Addr# -> (GHC.Types.Char -> a -> a) -> a -> a
-  unpackNBytes# :: GHC.Prim.Addr# -> GHC.Prim.Int# -> [GHC.Types.Char]
-
 module GHC.Profiling where
   -- Safety: Safe
   requestHeapCensus :: GHC.Types.IO ()


=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -12069,15 +12069,6 @@ module GHC.OverloadedLabels where
     fromLabel :: a
     {-# MINIMAL fromLabel #-}
 
-module GHC.Pack where
-  -- Safety: None
-  packCString# :: [GHC.Types.Char] -> GHC.Prim.ByteArray#
-  unpackAppendCString# :: GHC.Prim.Addr# -> [GHC.Types.Char] -> [GHC.Types.Char]
-  unpackCString :: forall a. GHC.Internal.Ptr.Ptr a -> [GHC.Types.Char]
-  unpackCString# :: GHC.Prim.Addr# -> [GHC.Types.Char]
-  unpackFoldrCString# :: forall a. GHC.Prim.Addr# -> (GHC.Types.Char -> a -> a) -> a -> a
-  unpackNBytes# :: GHC.Prim.Addr# -> GHC.Prim.Int# -> [GHC.Types.Char]
-
 module GHC.Profiling where
   -- Safety: Safe
   requestHeapCensus :: GHC.Types.IO ()


=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -9251,15 +9251,6 @@ module GHC.OverloadedLabels where
     fromLabel :: a
     {-# MINIMAL fromLabel #-}
 
-module GHC.Pack where
-  -- Safety: None
-  packCString# :: [GHC.Types.Char] -> GHC.Prim.ByteArray#
-  unpackAppendCString# :: GHC.Prim.Addr# -> [GHC.Types.Char] -> [GHC.Types.Char]
-  unpackCString :: forall a. GHC.Internal.Ptr.Ptr a -> [GHC.Types.Char]
-  unpackCString# :: GHC.Prim.Addr# -> [GHC.Types.Char]
-  unpackFoldrCString# :: forall a. GHC.Prim.Addr# -> (GHC.Types.Char -> a -> a) -> a -> a
-  unpackNBytes# :: GHC.Prim.Addr# -> GHC.Prim.Int# -> [GHC.Types.Char]
-
 module GHC.Profiling where
   -- Safety: Safe
   requestHeapCensus :: GHC.Types.IO ()


=====================================
testsuite/tests/interface-stability/base-exports.stdout-ws-32
=====================================
@@ -9027,15 +9027,6 @@ module GHC.OverloadedLabels where
     fromLabel :: a
     {-# MINIMAL fromLabel #-}
 
-module GHC.Pack where
-  -- Safety: None
-  packCString# :: [GHC.Types.Char] -> GHC.Prim.ByteArray#
-  unpackAppendCString# :: GHC.Prim.Addr# -> [GHC.Types.Char] -> [GHC.Types.Char]
-  unpackCString :: forall a. GHC.Internal.Ptr.Ptr a -> [GHC.Types.Char]
-  unpackCString# :: GHC.Prim.Addr# -> [GHC.Types.Char]
-  unpackFoldrCString# :: forall a. GHC.Prim.Addr# -> (GHC.Types.Char -> a -> a) -> a -> a
-  unpackNBytes# :: GHC.Prim.Addr# -> GHC.Prim.Int# -> [GHC.Types.Char]
-
 module GHC.Profiling where
   -- Safety: Safe
   requestHeapCensus :: GHC.Types.IO ()


=====================================
testsuite/tests/printer/T24237.hs
=====================================
@@ -0,0 +1,8 @@
+{-# LANGUAGE DataKinds #-}
+{-# OPTIONS_GHC -fprint-redundant-promotion-ticks #-}
+module T24237 where
+
+import Data.Proxy
+
+foo :: Proxy '(:)
+foo = ()


=====================================
testsuite/tests/printer/T24237.stderr
=====================================
@@ -0,0 +1,7 @@
+T24237.hs:8:7: error: [GHC-83865]
+    • Couldn't match expected type ‘Proxy '(:)’ with actual type ‘()’
+    • In the expression: ()
+      In an equation for ‘foo’: foo = ()
+    • Relevant bindings include
+        foo :: Proxy '(:) (bound at T24237.hs:8:1)
+


=====================================
testsuite/tests/printer/all.T
=====================================
@@ -210,3 +210,5 @@ test('Test24753', [ignore_stderr, req_ppr_deps], makefile_test, ['Test24753'])
 test('Test24771', [ignore_stderr, req_ppr_deps], makefile_test, ['Test24771'])
 test('Test24159', [ignore_stderr, req_ppr_deps], makefile_test, ['Test24159'])
 test('Test25132', [ignore_stderr, req_ppr_deps], makefile_test, ['Test25132'])
+
+test('T24237', normal, compile_fail, [''])


=====================================
testsuite/tests/simplCore/should_compile/T24625.hs
=====================================
@@ -0,0 +1,14 @@
+module T24625 where
+
+import GHC.IO.Exception
+import GHC.Exts
+
+data Foo = Foo !Int !Int String
+
+true :: Bool
+true = True
+{-# NOINLINE true #-}
+
+function :: Int -> Int -> String -> Int
+function !a !b c = case assertError true (Foo a b c) of
+  Foo a b c -> a + b


=====================================
testsuite/tests/simplCore/should_compile/all.T
=====================================
@@ -526,5 +526,6 @@ test('T24808', [ grep_errmsg(r'myFunction') ], compile, ['-O -ddump-simpl'])
 # T24944 needs -O2 because it's about SpecConstr
 test('T24944', [extra_files(['T24944a.hs'])], multimod_compile, ['T24944', '-v0 -O2'])
 
+test('T24625', [ grep_errmsg(r'case lazy') ], compile, ['-O -fno-ignore-asserts -ddump-simpl -dsuppress-uniques'])
 test('T24725a', [ grep_errmsg(r'testedRule')], compile, ['-O -ddump-rule-firings'])
 test('T25033', normal, compile, ['-O'])


=====================================
utils/haddock/doc/common-errors.rst
=====================================
@@ -4,7 +4,8 @@ Common Errors
 ``parse error on input ‘-- | xxx’``
 -----------------------------------
 
-This is probably caused by the ``-- | xxx`` comment not following a declaration. I.e. use ``-- xxx`` instead. See :ref:`top-level-declaration`.
+This is probably caused by the ``-- | xxx`` comment not being **before** a
+declaration, see :ref:`top-level-declaration`.
 
 ``parse error on input ‘-- $ xxx’``
 -----------------------------------


=====================================
utils/haddock/doc/markup.rst
=====================================
@@ -13,27 +13,26 @@ modules being processed.
 Documenting a Top-Level Declaration
 -----------------------------------
 
-The simplest example of a documentation annotation is for documenting
-any top-level declaration (function type signature, type declaration, or
-class declaration). For example, if the source file contains the
-following type signature: ::
+A Haddock documentation annotation is a comment that begins with ``-- |`` or
+``-- ^``. Seen as ordinary comments, these are ignored by the Haskell compiler.
 
-    square :: Int -> Int
-    square x = x * x
+We can document top-level declarations, such as ``square``, by **adding** a ``--
+|`` comment **before** the declaration or a ``-- ^`` comment **after** the
+declaration (each shown as a diff).
 
-Then we can document it like this: ::
+.. code-block:: diff
 
-    -- |The 'square' function squares an integer.
-    square :: Int -> Int
-    square x = x * x
+    + -- |The 'square' function squares an integer.
+      square :: Int -> Int
+      square x = x * x
 
-The ``-- |`` syntax begins a documentation annotation, which applies
-to the *following* declaration in the source file. Note that the
-annotation is just a comment in Haskell — it will be ignored by the
-Haskell compiler.
+.. code-block:: diff
 
-The declaration following a documentation annotation should be one of
-the following:
+      square :: Int -> Int
+    + -- ^The 'square' function squares an integer.
+      square x = x * x
+
+These annotations can document declarations that are:
 
 -  A type signature for a top-level function,
 
@@ -55,15 +54,7 @@ the following:
 
 -  A ``data instance`` or ``type instance`` declaration.
 
-If the annotation is followed by a different kind of declaration, it
-will probably be ignored by Haddock.
-
-Some people like to write their documentation *after* the declaration;
-this is possible in Haddock too: ::
-
-    square :: Int -> Int
-    -- ^The 'square' function squares an integer.
-    square x = x * x
+Other kinds of declaration will probably be ignored by Haddock.
 
 Since Haddock uses the GHC API internally, it can infer types for
 top-level functions without type signatures. However, you're



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e0f5ddf6790b668b468056ab8ab34d2788813d3b...4f08f0deab670a754def90f80060246df9d85df6

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e0f5ddf6790b668b468056ab8ab34d2788813d3b...4f08f0deab670a754def90f80060246df9d85df6
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240821/4b1c0ac6/attachment-0001.html>


More information about the ghc-commits mailing list