Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-ghc-lib-parser for 
openSUSE:Factory checked in at 2023-06-22 23:25:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-ghc-lib-parser (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-ghc-lib-parser.new.15902 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-ghc-lib-parser"

Thu Jun 22 23:25:24 2023 rev:2 rq:1094431 version:9.4.5.20230430

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-ghc-lib-parser/ghc-ghc-lib-parser.changes    
2023-04-04 21:20:18.397146873 +0200
+++ 
/work/SRC/openSUSE:Factory/.ghc-ghc-lib-parser.new.15902/ghc-ghc-lib-parser.changes
 2023-06-22 23:25:49.161767611 +0200
@@ -1,0 +2,6 @@
+Sun Apr 30 01:12:50 UTC 2023 - Peter Simons <psim...@suse.com>
+
+- Update ghc-lib-parser to version 9.4.5.20230430.
+  Upstream does not provide a change log file.
+
+-------------------------------------------------------------------

Old:
----
  ghc-lib-parser-9.4.4.20221225.tar.gz

New:
----
  ghc-lib-parser-9.4.5.20230430.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-ghc-lib-parser.spec ++++++
--- /var/tmp/diff_new_pack.IVwHAi/_old  2023-06-22 23:25:49.729770507 +0200
+++ /var/tmp/diff_new_pack.IVwHAi/_new  2023-06-22 23:25:49.733770528 +0200
@@ -19,7 +19,7 @@
 %global pkg_name ghc-lib-parser
 %global pkgver %{pkg_name}-%{version}
 Name:           ghc-%{pkg_name}
-Version:        9.4.4.20221225
+Version:        9.4.5.20230430
 Release:        0
 Summary:        The GHC API, decoupled from GHC versions
 License:        BSD-3-Clause

++++++ ghc-lib-parser-9.4.4.20221225.tar.gz -> 
ghc-lib-parser-9.4.5.20230430.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/ByteCode/Types.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/ByteCode/Types.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/ByteCode/Types.hs    
2022-12-25 15:53:35.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/ByteCode/Types.hs    
2023-04-30 02:46:45.000000000 +0200
@@ -22,12 +22,10 @@
 
 import GHC.Data.FastString
 import GHC.Data.SizedSeq
-import GHC.Types.Id
 import GHC.Types.Name
 import GHC.Types.Name.Env
 import GHC.Utils.Outputable
 import GHC.Builtin.PrimOps
-import GHC.Core.Type
 import GHC.Types.SrcLoc
 import GHCi.BreakArray
 import GHCi.RemoteTypes
@@ -40,10 +38,10 @@
 import Data.ByteString (ByteString)
 import Data.IntMap (IntMap)
 import qualified Data.IntMap as IntMap
-import Data.Maybe (catMaybes)
 import qualified GHC.Exts.Heap as Heap
 import GHC.Stack.CCS
 import GHC.Cmm.Expr ( GlobalRegSet, emptyRegSet, regSetToList )
+import GHC.Iface.Syntax
 
 -- 
-----------------------------------------------------------------------------
 -- Compiled Byte Code
@@ -163,18 +161,22 @@
   rnf x = x `seq` ()
 
 -- | Information about a breakpoint that we know at code-generation time
+-- In order to be used, this needs to be hydrated relative to the current 
HscEnv by
+-- 'hydrateCgBreakInfo'. Everything here can be fully forced and that's 
critical for
+-- preventing space leaks (see #22530)
 data CgBreakInfo
    = CgBreakInfo
-   { cgb_vars   :: [Maybe (Id,Word16)]
-   , cgb_resty  :: Type
+   { cgb_tyvars :: ![IfaceTvBndr] -- ^ Type variables in scope at the 
breakpoint
+   , cgb_vars   :: ![Maybe (IfaceIdBndr, Word16)]
+   , cgb_resty  :: !IfaceType
    }
 -- See Note [Syncing breakpoint info] in GHC.Runtime.Eval
 
--- Not a real NFData instance because we can't rnf Id or Type
 seqCgBreakInfo :: CgBreakInfo -> ()
 seqCgBreakInfo CgBreakInfo{..} =
-  rnf (map snd (catMaybes (cgb_vars))) `seq`
-  seqType cgb_resty
+    rnf cgb_tyvars `seq`
+    rnf cgb_vars `seq`
+    rnf cgb_resty
 
 instance Outputable UnlinkedBCO where
    ppr (UnlinkedBCO nm _arity _insns _bitmap lits ptrs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Core/Opt/ConstantFold.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Core/Opt/ConstantFold.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Core/Opt/ConstantFold.hs     
2022-12-25 15:53:35.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Core/Opt/ConstantFold.hs     
2023-04-30 02:46:46.000000000 +0200
@@ -1112,16 +1112,11 @@
 --------------------------
 doubleDecodeOp :: RuleOpts -> Literal -> Maybe CoreExpr
 doubleDecodeOp env (LitDouble ((decodeFloat . fromRational @Double) -> (m, e)))
-  = Just $ mkCoreUbxTup [iNT64Ty, intPrimTy]
-                        [ Lit (mkLitINT64 (toInteger m))
+  = Just $ mkCoreUbxTup [int64PrimTy, intPrimTy]
+                        [ Lit (mkLitInt64Wrap (toInteger m))
                         , mkIntVal platform (toInteger e) ]
   where
     platform = roPlatform env
-    (iNT64Ty, mkLitINT64)
-      | platformWordSizeInBits platform < 64
-      = (int64PrimTy, mkLitInt64Wrap)
-      | otherwise
-      = (intPrimTy  , mkLitIntWrap platform)
 doubleDecodeOp _   _
   = Nothing
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Core/Opt/OccurAnal.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Core/Opt/OccurAnal.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Core/Opt/OccurAnal.hs        
2022-12-25 15:53:35.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Core/Opt/OccurAnal.hs        
2023-04-30 02:46:46.000000000 +0200
@@ -1812,7 +1812,8 @@
 
 occAnalLam env (Lam bndr expr)
   | isTyVar bndr
-  = let (WithUsageDetails usage expr') = occAnalLam env expr
+  = let env1 = addOneInScope env bndr
+        WithUsageDetails usage expr' = occAnalLam env1 expr
     in WithUsageDetails usage (Lam bndr expr')
        -- Important: Keep the 'env' unchanged so that with a RHS like
        --   \(@ x) -> K @x (f @x)
@@ -2458,9 +2459,10 @@
            -- then please replace x by (y |> sym mco)
            -- Invariant of course: idType x = exprType (y |> sym mco)
            , occ_bs_env  :: !(VarEnv (OutId, MCoercion))
-           , occ_bs_rng  :: !VarSet   -- Vars free in the range of occ_bs_env
                    -- Domain is Global and Local Ids
                    -- Range is just Local Ids
+           , occ_bs_rng  :: !VarSet
+                   -- Vars (TyVars and Ids) free in the range of occ_bs_env
     }
 
 
@@ -2537,14 +2539,15 @@
                                           _      -> False
 
 addOneInScope :: OccEnv -> CoreBndr -> OccEnv
+-- Needed for all Vars not just Ids
+-- See Note [The binder-swap substitution] (BS3)
 addOneInScope env@(OccEnv { occ_bs_env = swap_env, occ_bs_rng = rng_vars }) 
bndr
   | bndr `elemVarSet` rng_vars = env { occ_bs_env = emptyVarEnv, occ_bs_rng = 
emptyVarSet }
   | otherwise                  = env { occ_bs_env = swap_env `delVarEnv` bndr }
 
 addInScope :: OccEnv -> [Var] -> OccEnv
--- See Note [The binder-swap substitution]
--- It's only neccessary to call this on in-scope Ids,
--- but harmless to include TyVars too
+-- Needed for all Vars not just Ids
+-- See Note [The binder-swap substitution] (BS3)
 addInScope env@(OccEnv { occ_bs_env = swap_env, occ_bs_rng = rng_vars }) bndrs
   | any (`elemVarSet` rng_vars) bndrs = env { occ_bs_env = emptyVarEnv, 
occ_bs_rng = emptyVarSet }
   | otherwise                         = env { occ_bs_env = swap_env 
`delVarEnvList` bndrs }
@@ -2703,25 +2706,29 @@
 
 (BS3) We need care when shadowing.  Suppose [x :-> b] is in occ_bs_env,
       and we encounter:
-         - \x. blah
-           Here we want to delete the x-binding from occ_bs_env
+         (i) \x. blah
+             Here we want to delete the x-binding from occ_bs_env
 
-         - \b. blah
-           This is harder: we really want to delete all bindings that
-           have 'b' free in the range.  That is a bit tiresome to implement,
-           so we compromise.  We keep occ_bs_rng, which is the set of
-           free vars of rng(occc_bs_env).  If a binder shadows any of these
-           variables, we discard all of occ_bs_env.  Safe, if a bit
-           brutal.  NB, however: the simplifer de-shadows the code, so the
-           next time around this won't happen.
+         (ii) \b. blah
+              This is harder: we really want to delete all bindings that
+              have 'b' free in the range.  That is a bit tiresome to implement,
+              so we compromise.  We keep occ_bs_rng, which is the set of
+              free vars of rng(occc_bs_env).  If a binder shadows any of these
+              variables, we discard all of occ_bs_env.  Safe, if a bit
+              brutal.  NB, however: the simplifer de-shadows the code, so the
+              next time around this won't happen.
 
       These checks are implemented in addInScope.
-
-      The occurrence analyser itself does /not/ do cloning. It could, in
-      principle, but it'd make it a bit more complicated and there is no
-      great benefit. The simplifer uses cloning to get a no-shadowing
-      situation, the care-when-shadowing behaviour above isn't needed for
-      long.
+      (i) is needed only for Ids, but (ii) is needed for tyvars too (#22623)
+      because if occ_bs_env has [x :-> ...a...] where `a` is a tyvar, we
+      must not replace `x` by `...a...` under /\a. ...x..., or similarly
+      under a case pattern match that binds `a`.
+
+      An alternative would be for the occurrence analyser to do cloning as
+      it goes.  In principle it could do so, but it'd make it a bit more
+      complicated and there is no great benefit. The simplifer uses
+      cloning to get a no-shadowing situation, the care-when-shadowing
+      behaviour above isn't needed for long.
 
 (BS4) The domain of occ_bs_env can include GlobaIds.  Eg
          case M.foo of b { alts }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Core/Type.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Core/Type.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Core/Type.hs 2022-12-25 
15:53:35.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Core/Type.hs 2023-04-30 
02:46:46.000000000 +0200
@@ -49,7 +49,7 @@
         mkSpecForAllTy, mkSpecForAllTys,
         mkVisForAllTys, mkTyCoInvForAllTy,
         mkInfForAllTy, mkInfForAllTys,
-        splitForAllTyCoVars,
+        splitForAllTyCoVars, splitForAllTyVars,
         splitForAllReqTVBinders, splitForAllInvisTVBinders,
         splitForAllTyCoVarBinders,
         splitForAllTyCoVar_maybe, splitForAllTyCoVar,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Core/Unify.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Core/Unify.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Core/Unify.hs        
2022-12-25 15:53:35.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Core/Unify.hs        
2023-04-30 02:46:46.000000000 +0200
@@ -1,6 +1,6 @@
 -- (c) The University of Glasgow 2006
 
-{-# LANGUAGE ScopedTypeVariables, PatternSynonyms #-}
+{-# LANGUAGE ScopedTypeVariables, PatternSynonyms, MultiWayIf #-}
 
 {-# LANGUAGE DeriveFunctor #-}
 
@@ -50,6 +50,7 @@
 import GHC.Types.Unique.Set
 import {-# SOURCE #-} GHC.Tc.Utils.TcType ( tcEqType )
 import GHC.Exts( oneShot )
+import GHC.Utils.Panic
 import GHC.Utils.Panic.Plain
 import GHC.Data.FastString
 
@@ -1045,6 +1046,59 @@
 (legitimately) have different numbers of arguments.  They
 are surelyApart, so we can report that without looking any
 further (see #15704).
+
+Note [Unifying type applications]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Unifying type applications is quite subtle, as we found
+in #23134 and #22647, when type families are involved.
+
+Suppose
+   type family F a :: Type -> Type
+   type family G k :: k = r | r -> k
+
+and consider these examples:
+
+* F Int ~ F Char, where F is injective
+  Since F is injective, we can reduce this to Int ~ Char,
+  therefore SurelyApart.
+
+* F Int ~ F Char, where F is not injective
+  Without injectivity, return MaybeApart.
+
+* G Type ~ G (Type -> Type) Int
+  Even though G is injective and the arguments to G are different,
+  we cannot deduce apartness because the RHS is oversaturated.
+  For example, G might be defined as
+    G Type = Maybe Int
+    G (Type -> Type) = Maybe
+  So we return MaybeApart.
+
+* F Int Bool ~ F Int Char       -- SurelyApart (since Bool is apart from Char)
+  F Int Bool ~ Maybe a          -- MaybeApart
+  F Int Bool ~ a b              -- MaybeApart
+  F Int Bool ~ Char -> Bool     -- MaybeApart
+  An oversaturated type family can match an application,
+  whether it's a TyConApp, AppTy or FunTy. Decompose.
+
+* F Int ~ a b
+  We cannot decompose a saturated, or under-saturated
+  type family application. We return MaybeApart.
+
+To handle all those conditions, unify_ty goes through
+the following checks in sequence, where Fn is a type family
+of arity n:
+
+* (C1) Fn x_1 ... x_n ~ Fn y_1 .. y_n
+  A saturated application.
+  Here we can unify arguments in which Fn is injective.
+* (C2) Fn x_1 ... x_n ~ anything, anything ~ Fn x_1 ... x_n
+  A saturated type family can match anything - we return MaybeApart.
+* (C3) Fn x_1 ... x_m ~ a b, a b ~ Fn x_1 ... x_m where m > n
+  An oversaturated type family can be decomposed.
+* (C4) Fn x_1 ... x_m ~ anything, anything ~ Fn x_1 ... x_m, where m > n
+  If we couldn't decompose in the previous step, we return SurelyApart.
+
+Afterwards, the rest of the code doesn't have to worry about type families.
 -}
 
 -------------- unify_ty: the main workhorse -----------
@@ -1093,42 +1147,62 @@
   = uVar (umSwapRn env) tv2 ty1 (mkSymCo kco)
 
 unify_ty env ty1 ty2 _kco
- -- NB: This keeps Constraint and Type distinct, as it should for use in the
- -- type-checker.
-  | Just (tc1, tys1) <- mb_tc_app1
-  , Just (tc2, tys2) <- mb_tc_app2
+  -- Handle non-oversaturated type families first
+  -- See Note [Unifying type applications]
+  --
+  -- (C1) If we have T x1 ... xn ~ T y1 ... yn, use injectivity information of 
T
+  -- Note that both sides must not be oversaturated
+  | Just (tc1, tys1) <- isSatTyFamApp mb_tc_app1
+  , Just (tc2, tys2) <- isSatTyFamApp mb_tc_app2
   , tc1 == tc2
-  = if isInjectiveTyCon tc1 Nominal
-    then unify_tys env tys1 tys2
-    else do { let inj | isTypeFamilyTyCon tc1
-                      = case tyConInjectivityInfo tc1 of
-                               NotInjective -> repeat False
-                               Injective bs -> bs
-                      | otherwise
-                      = repeat False
-
-                  (inj_tys1, noninj_tys1) = partitionByList inj tys1
-                  (inj_tys2, noninj_tys2) = partitionByList inj tys2
-
-            ; unify_tys env inj_tys1 inj_tys2
-            ; unless (um_inj_tf env) $ -- See (end of) Note [Specification of 
unification]
-              don'tBeSoSure MARTypeFamily $ unify_tys env noninj_tys1 
noninj_tys2 }
-
+  = do { let inj = case tyConInjectivityInfo tc1 of
+                          NotInjective -> repeat False
+                          Injective bs -> bs
+
+             (inj_tys1, noninj_tys1) = partitionByList inj tys1
+             (inj_tys2, noninj_tys2) = partitionByList inj tys2
+
+       ; unify_tys env inj_tys1 inj_tys2
+       ; unless (um_inj_tf env) $ -- See (end of) Note [Specification of 
unification]
+         don'tBeSoSure MARTypeFamily $ unify_tys env noninj_tys1 noninj_tys2 }
+
+  | Just _ <- isSatTyFamApp mb_tc_app1  -- (C2) A (not-over-saturated) 
type-family application
+  = maybeApart MARTypeFamily            -- behaves like a type variable; might 
match
+
+  | Just _ <- isSatTyFamApp mb_tc_app2  -- (C2) A (not-over-saturated) 
type-family application
+                                        -- behaves like a type variable; might 
unify
+                                        -- but doesn't match (as in the 
TyVarTy case)
+  = if um_unif env then maybeApart MARTypeFamily else surelyApart
+
+  -- Handle oversaturated type families.
+  --
+  -- They can match an application (TyConApp/FunTy/AppTy), this is handled
+  -- the same way as in the AppTy case below.
+  --
+  -- If there is no application, an oversaturated type family can only
+  -- match a type variable or a saturated type family,
+  -- both of which we handled earlier. So we can say surelyApart.
   | Just (tc1, _) <- mb_tc_app1
-  , not (isGenerativeTyCon tc1 Nominal)
-    -- E.g.   unify_ty (F ty1) b  =  MaybeApart
-    --        because the (F ty1) behaves like a variable
-    --        NB: if unifying, we have already dealt
-    --            with the 'ty2 = variable' case
-  = maybeApart MARTypeFamily
+  , isTypeFamilyTyCon tc1
+  = if | Just (ty1a, ty1b) <- tcRepSplitAppTy_maybe ty1
+       , Just (ty2a, ty2b) <- tcRepSplitAppTy_maybe ty2
+       -> unify_ty_app env ty1a [ty1b] ty2a [ty2b]            -- (C3)
+       | otherwise -> surelyApart                             -- (C4)
 
   | Just (tc2, _) <- mb_tc_app2
-  , not (isGenerativeTyCon tc2 Nominal)
-  , um_unif env
-    -- E.g.   unify_ty [a] (F ty2) =  MaybeApart, when unifying (only)
-    --        because the (F ty2) behaves like a variable
-    --        NB: we have already dealt with the 'ty1 = variable' case
-  = maybeApart MARTypeFamily
+  , isTypeFamilyTyCon tc2
+  = if | Just (ty1a, ty1b) <- tcRepSplitAppTy_maybe ty1
+       , Just (ty2a, ty2b) <- tcRepSplitAppTy_maybe ty2
+       -> unify_ty_app env ty1a [ty1b] ty2a [ty2b]            -- (C3)
+       | otherwise -> surelyApart                             -- (C4)
+
+  -- At this point, neither tc1 nor tc2 can be a type family.
+  | Just (tc1, tys1) <- mb_tc_app1
+  , Just (tc2, tys2) <- mb_tc_app2
+  , tc1 == tc2
+  = do { massertPpr (isInjectiveTyCon tc1 Nominal) (ppr tc1)
+       ; unify_tys env tys1 tys2
+       }
 
   where
     mb_tc_app1 = tcSplitTyConApp_maybe ty1
@@ -1216,6 +1290,17 @@
       -- Possibly different saturations of a polykinded tycon
       -- See Note [Polykinded tycon applications]
 
+isSatTyFamApp :: Maybe (TyCon, [Type]) -> Maybe (TyCon, [Type])
+-- Return the argument if we have a saturated type family application
+-- If it is /over/ saturated then we return False.  E.g.
+--     unify_ty (F a b) (c d)    where F has arity 1
+-- we definitely want to decompose that type application! (#22647)
+isSatTyFamApp tapp@(Just (tc, tys))
+  |  isTypeFamilyTyCon tc
+  && not (tys `lengthExceeds` tyConArity tc)  -- Not over-saturated
+  = tapp
+isSatTyFamApp _ = Nothing
+
 ---------------------------------
 uVar :: UMEnv
      -> InTyVar         -- Variable to be unified
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Core/Utils.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Core/Utils.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Core/Utils.hs        
2022-12-25 15:53:35.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Core/Utils.hs        
2023-04-30 02:46:46.000000000 +0200
@@ -166,7 +166,7 @@
 coreAltsType (alt:_) = coreAltType alt
 coreAltsType []      = panic "coreAltsType"
 
-mkLamType  :: Var -> Type -> Type
+mkLamType  :: HasDebugCallStack => Var -> Type -> Type
 -- ^ Makes a @(->)@ type or an implicit forall type, depending
 -- on whether it is given a type variable or a term variable.
 -- This is used, for example, when producing the type of a lambda.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Core.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Core.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Core.hs      2022-12-25 
15:53:35.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Core.hs      2023-04-30 
02:46:45.000000000 +0200
@@ -368,13 +368,69 @@
 
 Note [Core letrec invariant]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The right hand sides of all top-level and recursive @let@s
-/must/ be of lifted type (see "Type#type_classification" for
-the meaning of /lifted/ vs. /unlifted/).
-
-There is one exception to this rule, top-level @let@s are
-allowed to bind primitive string literals: see
-Note [Core top-level string literals].
+The Core letrec invariant:
+
+    The right hand sides of all
+      /top-level/ or /recursive/
+    bindings must be of lifted type
+
+    There is one exception to this rule, top-level @let@s are
+    allowed to bind primitive string literals: see
+    Note [Core top-level string literals].
+
+See "Type#type_classification" in GHC.Core.Type
+for the meaning of "lifted" vs. "unlifted").
+
+For the non-top-level, non-recursive case see Note [Core let-can-float 
invariant].
+
+Note [Core let-can-float invariant]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The let-can-float invariant:
+
+    The right hand side of a /non-top-level/, /non-recursive/ binding
+    may be of unlifted type, but only if
+    the expression is ok-for-speculation
+    or the 'Let' is for a join point.
+
+    (For top-level or recursive lets see Note [Core letrec invariant].)
+
+This means that the let can be floated around
+without difficulty. For example, this is OK:
+
+   y::Int# = x +# 1#
+
+But this is not, as it may affect termination if the
+expression is floated out:
+
+   y::Int# = fac 4#
+
+In this situation you should use @case@ rather than a @let@. The function
+'GHC.Core.Utils.needsCaseBinding' can help you determine which to generate, or
+alternatively use 'GHC.Core.Make.mkCoreLet' rather than this constructor 
directly,
+which will generate a @case@ if necessary
+
+The let-can-float invariant is initially enforced by mkCoreLet in 
GHC.Core.Make.
+
+For discussion of some implications of the let-can-float invariant primops see
+Note [Checking versus non-checking primops] in GHC.Builtin.PrimOps.
+
+Historical Note [The let/app invariant]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Before 2022 GHC used the "let/app invariant", which applied the let-can-float 
rules
+to the argument of an application, as well as to the RHS of a let.  This made 
some
+kind of sense, because 'let' can always be encoded as application:
+   let x=rhs in b   =    (\x.b) rhs
+
+But the let/app invariant got in the way of RULES; see #19313.  For example
+  up :: Int# -> Int#
+  {-# RULES "up/down" forall x. up (down x) = x #-}
+The LHS of this rule doesn't satisfy the let/app invariant.
+
+Indeed RULES is a big reason that GHC doesn't use ANF, where the argument of an
+application is always a variable or a constant.  To allow RULES to work nicely
+we need to allow lots of things in the arguments of a call.
+
+TL;DR: we relaxed the let/app invariant to become the let-can-float invariant.
 
 Note [Core top-level string literals]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -414,6 +470,8 @@
   Note [Core top-level string literals]. Core-to-core passes may introduce
   new top-level string literals.
 
+  See GHC.Core.Utils.exprIsTopLevelBindable, and exprIsTickedString
+
 * In STG, top-level string literals are explicitly represented in the syntax
   tree.
 
@@ -421,14 +479,9 @@
   in the object file, the content of the exported literal is given a label with
   the _bytes suffix.
 
-Note [Core let/app invariant]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The let/app invariant
-     the right hand side of a non-recursive 'Let', and
-     the argument of an 'App',
-    /may/ be of unlifted type, but only if
-    the expression is ok-for-speculation
-    or the 'Let' is for a join point.
+Note [NON-BOTTOM-DICTS invariant]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+It is a global invariant (not checkable by Lint) that
 
 This means that the let can be floated around
 without difficulty. For example, this is OK:
@@ -448,8 +501,24 @@
 The let/app invariant is initially enforced by mkCoreLet and mkCoreApp in
 GHC.Core.Make.
 
-For discussion of some implications of the let/app invariant primops see
-Note [Checking versus non-checking primops] in GHC.Builtin.PrimOps.
+* A superclass selection from some other dictionary. This is harder to 
guarantee:
+  see Note [Recursive superclasses] and Note [Solving superclass constraints]
+  in GHC.Tc.TyCl.Instance.
+
+A bad Core-to-Core pass could invalidate this reasoning, but that's too bad.
+It's still an invariant of Core programs generated by GHC from Haskell, and
+Core-to-Core passes maintain it.
+
+Why is it useful to know that dictionaries are non-bottom?
+
+1. It justifies the use of `-XDictsStrict`;
+   see `GHC.Core.Types.Demand.strictifyDictDmd`
+
+2. It means that (eq_sel d) is ok-for-speculation and thus
+     case (eq_sel d) of _ -> blah
+   can be discarded by the Simplifier.  See these Notes:
+   Note [exprOkForSpeculation and type classes] in GHC.Core.Utils
+   Note[Speculative evaluation] in GHC.CoreToStg.Prep
 
 Note [Case expression invariants]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/CoreToIface.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/CoreToIface.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/CoreToIface.hs       
2022-12-25 15:53:35.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/CoreToIface.hs       
2023-04-30 02:46:45.000000000 +0200
@@ -42,12 +42,18 @@
     , toIfaceVar
       -- * Other stuff
     , toIfaceLFInfo
+      -- * CgBreakInfo
+    , dehydrateCgBreakInfo
     ) where
 
 import GHC.Prelude
 
+import Data.Word
+
 import GHC.StgToCmm.Types
 
+import GHC.ByteCode.Types
+
 import GHC.Core
 import GHC.Core.TyCon hiding ( pprPromotionQuote )
 import GHC.Core.Coercion.Axiom
@@ -658,6 +664,16 @@
     LFLetNoEscape ->
       panic "toIfaceLFInfo: LFLetNoEscape"
 
+-- Dehydrating CgBreakInfo
+
+dehydrateCgBreakInfo :: [TyVar] -> [Maybe (Id, Word16)] -> Type -> CgBreakInfo
+dehydrateCgBreakInfo ty_vars idOffSets tick_ty =
+          CgBreakInfo
+            { cgb_tyvars = map toIfaceTvBndr ty_vars
+            , cgb_vars = map (fmap (\(i, offset) -> (toIfaceIdBndr i, 
offset))) idOffSets
+            , cgb_resty = toIfaceType tick_ty
+            }
+
 {- Note [Inlining and hs-boot files]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Consider this example (#10083, #12789):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Driver/Errors/Ppr.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Driver/Errors/Ppr.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Driver/Errors/Ppr.hs 
2022-12-25 15:53:35.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Driver/Errors/Ppr.hs 
2023-04-30 02:46:46.000000000 +0200
@@ -76,28 +76,29 @@
       -> diagnosticMessage m
     DriverPsHeaderMessage m
       -> diagnosticMessage m
-    DriverMissingHomeModules missing buildingCabalPackage
+    DriverMissingHomeModules uid missing buildingCabalPackage
       -> let msg | buildingCabalPackage == YesBuildingCabalPackage
                  = hang
-                     (text "These modules are needed for compilation but not 
listed in your .cabal file's other-modules: ")
+                     (text "These modules are needed for compilation but not 
listed in your .cabal file's other-modules for" <+> quotes (ppr uid) <+> text 
":")
                      4
                      (sep (map ppr missing))
                  | otherwise
                  =
                    hang
-                     (text "Modules are not listed in command line but needed 
for compilation: ")
+                     (text "Modules are not listed in options for"
+                        <+> quotes (ppr uid) <+> text "but needed for 
compilation:")
                      4
                      (sep (map ppr missing))
          in mkSimpleDecorated msg
-    DriverUnknownHiddenModules missing
+    DriverUnknownHiddenModules uid missing
       -> let msg = hang
-                     (text "Modules are listened as hidden but not part of the 
unit: ")
+                     (text "Modules are listed as hidden in options for" <+> 
quotes (ppr uid) <+> text "but not part of the unit:")
                      4
                      (sep (map ppr missing))
          in mkSimpleDecorated msg
-    DriverUnknownReexportedModules missing
+    DriverUnknownReexportedModules uid missing
       -> let msg = hang
-                     (text "Modules are listened as reexported but can't be 
found in any dependency: ")
+                     (text "Modules are listed as reexported in options for" 
<+> quotes (ppr uid) <+> text "but can't be found in any dependency:")
                      4
                      (sep (map ppr missing))
          in mkSimpleDecorated msg
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Driver/Errors/Types.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Driver/Errors/Types.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Driver/Errors/Types.hs       
2022-12-25 15:53:35.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Driver/Errors/Types.hs       
2023-04-30 02:46:46.000000000 +0200
@@ -126,17 +126,17 @@
       Test case: warnings/should_compile/MissingMod
 
   -}
-  DriverMissingHomeModules :: [ModuleName] -> !BuildingCabalPackage -> 
DriverMessage
+  DriverMissingHomeModules :: UnitId -> [ModuleName] -> !BuildingCabalPackage 
-> DriverMessage
 
   {-| DriverUnknown is a warning that arises when a user tries to
       reexport a module which isn't part of that unit.
   -}
-  DriverUnknownReexportedModules :: [ModuleName] -> DriverMessage
+  DriverUnknownReexportedModules :: UnitId -> [ModuleName] -> DriverMessage
 
   {-| DriverUnknownHiddenModules is a warning that arises when a user tries to
       hide a module which isn't part of that unit.
   -}
-  DriverUnknownHiddenModules :: [ModuleName] -> DriverMessage
+  DriverUnknownHiddenModules :: UnitId -> [ModuleName] -> DriverMessage
 
   {-| DriverUnusedPackages occurs when when package is requested on command 
line,
       but was never needed during compilation. Activated by -Wunused-packages.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Hs/Utils.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Hs/Utils.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Hs/Utils.hs  2022-12-25 
15:53:35.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Hs/Utils.hs  2023-04-30 
02:46:46.000000000 +0200
@@ -912,7 +912,7 @@
                        emptyLocalBinds]
 
 -- | Make a prefix, non-strict function 'HsMatchContext'
-mkPrefixFunRhs :: LIdP p -> HsMatchContext p
+mkPrefixFunRhs :: LIdP (NoGhcTc p) -> HsMatchContext p
 mkPrefixFunRhs n = FunRhs { mc_fun = n
                           , mc_fixity = Prefix
                           , mc_strictness = NoSrcStrict }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Tc/Solver/Types.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Tc/Solver/Types.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Tc/Solver/Types.hs   
2022-12-25 15:53:36.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Tc/Solver/Types.hs   
2023-04-30 02:46:46.000000000 +0200
@@ -275,21 +275,29 @@
   | debugIsOn
   = case ct of
       CEqCan { cc_lhs = TyVarLHS tv } ->
-        let shares_lhs (CEqCan { cc_lhs = TyVarLHS old_tv }) = tv == old_tv
-            shares_lhs _other                                = False
-        in
-        assert (all shares_lhs old_eqs) $
-        assert (null ([ (ct1, ct2) | ct1 <- ct : old_eqs
-                                   , ct2 <- ct : old_eqs
-                                   , let { fr1 = ctFlavourRole ct1
-                                         ; fr2 = ctFlavourRole ct2 }
-                                   , fr1 `eqCanRewriteFR` fr2 ])) $
+        assert (all (shares_lhs tv) old_eqs) $
+        assertPpr (null bad_prs)
+                  (vcat [ text "bad_prs" <+> ppr bad_prs
+                        , text "ct:old_eqs" <+> ppr (ct : old_eqs) ]) $
         (ct : old_eqs)
 
       _ -> pprPanic "addToEqualCtList not CEqCan" (ppr ct)
 
   | otherwise
   = ct : old_eqs
+  where
+    shares_lhs tv (CEqCan { cc_lhs = TyVarLHS old_tv }) = tv == old_tv
+    shares_lhs _ _ = False
+    bad_prs = filter is_bad_pair (distinctPairs (ct : old_eqs))
+    is_bad_pair (ct1,ct2) = ctFlavourRole ct1 `eqCanRewriteFR` ctFlavourRole 
ct2
+
+distinctPairs :: [a] -> [(a,a)]
+-- distinctPairs [x1,...xn] is the list of all pairs [ ...(xi, xj)...]
+--                             where i /= j
+-- NB: does not return pairs (xi,xi), which would be stupid in the
+--     context of addToEqualCtList (#22645)
+distinctPairs []     = []
+distinctPairs (x:xs) = concatMap (\y -> [(x,y),(y,x)]) xs ++ distinctPairs xs
 
 -- returns Nothing when the new list is empty, to keep the environments smaller
 filterEqualCtList :: (Ct -> Bool) -> EqualCtList -> Maybe EqualCtList
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Tc/Types/Constraint.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Tc/Types/Constraint.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Tc/Types/Constraint.hs       
2022-12-25 15:53:36.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Tc/Types/Constraint.hs       
2023-04-30 02:46:46.000000000 +0200
@@ -9,14 +9,15 @@
 -- in the type-checker and constraint solver.
 module GHC.Tc.Types.Constraint (
         -- QCInst
-        QCInst(..), isPendingScInst,
+        QCInst(..), pendingScInst_maybe,
 
         -- Canonical constraints
         Xi, Ct(..), Cts,
         emptyCts, andCts, andManyCts, pprCts,
         singleCt, listToCts, ctsElts, consCts, snocCts, extendCtsList,
         isEmptyCts,
-        isPendingScDict, superClassesMightHelp, getPendingWantedScs,
+        isPendingScDict, pendingScDict_maybe,
+        superClassesMightHelp, getPendingWantedScs,
         isWantedCt, isGivenCt,
         isUserTypeError, getUserTypeErrorMsg,
         ctEvidence, ctLoc, ctPred, ctFlavour, ctEqRel, ctOrigin,
@@ -899,18 +900,24 @@
                              Just _ -> True
                              _      -> False
 
-isPendingScDict :: Ct -> Maybe Ct
+isPendingScDict :: Ct -> Bool
+isPendingScDict (CDictCan { cc_pend_sc = psc }) = psc
+-- Says whether this is a CDictCan with cc_pend_sc is True;
+-- i.e. pending un-expanded superclasses
+isPendingScDict _ = False
+
+pendingScDict_maybe :: Ct -> Maybe Ct
 -- Says whether this is a CDictCan with cc_pend_sc is True,
 -- AND if so flips the flag
-isPendingScDict ct@(CDictCan { cc_pend_sc = True })
-                  = Just (ct { cc_pend_sc = False })
-isPendingScDict _ = Nothing
+pendingScDict_maybe ct@(CDictCan { cc_pend_sc = True })
+                      = Just (ct { cc_pend_sc = False })
+pendingScDict_maybe _ = Nothing
 
-isPendingScInst :: QCInst -> Maybe QCInst
+pendingScInst_maybe :: QCInst -> Maybe QCInst
 -- Same as isPendingScDict, but for QCInsts
-isPendingScInst qci@(QCI { qci_pend_sc = True })
-                  = Just (qci { qci_pend_sc = False })
-isPendingScInst _ = Nothing
+pendingScInst_maybe qci@(QCI { qci_pend_sc = True })
+                      = Just (qci { qci_pend_sc = False })
+pendingScInst_maybe _ = Nothing
 
 superClassesMightHelp :: WantedConstraints -> Bool
 -- ^ True if taking superclasses of givens, or of wanteds (to perhaps
@@ -932,7 +939,7 @@
 getPendingWantedScs simples
   = mapAccumBagL get [] simples
   where
-    get acc ct | Just ct' <- isPendingScDict ct
+    get acc ct | Just ct' <- pendingScDict_maybe ct
                = (ct':acc, ct')
                | otherwise
                = (acc,     ct)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Types/Name.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Types/Name.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Types/Name.hs        
2022-12-25 15:53:36.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Types/Name.hs        
2023-04-30 02:46:46.000000000 +0200
@@ -151,7 +151,7 @@
   ppr  System         = text "system"
 
 instance NFData Name where
-  rnf Name{..} = rnf n_sort
+  rnf Name{..} = rnf n_sort `seq` rnf n_occ `seq` n_uniq `seq` rnf n_loc
 
 instance NFData NameSort where
   rnf (External m) = rnf m
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Unit/Env.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Unit/Env.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Unit/Env.hs  2022-12-25 
15:53:36.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Unit/Env.hs  2023-04-30 
02:46:47.000000000 +0200
@@ -12,6 +12,7 @@
     , ue_setUnits
     , ue_setUnitFlags
     , ue_unit_dbs
+    , ue_all_home_unit_ids
     , ue_setUnitDbs
     , ue_hpt
     , ue_homeUnit
@@ -417,7 +418,8 @@
 ue_unitHomeUnit :: UnitId -> UnitEnv -> HomeUnit
 ue_unitHomeUnit uid ue_env = homeUnitEnv_unsafeHomeUnit $ ue_findHomeUnitEnv 
uid ue_env
 
-
+ue_all_home_unit_ids :: UnitEnv -> Set.Set UnitId
+ue_all_home_unit_ids = unitEnv_keys . ue_home_unit_graph
 -- -------------------------------------------------------
 -- Query and modify the currently active unit
 -- -------------------------------------------------------
@@ -437,6 +439,7 @@
 ue_currentUnit :: UnitEnv -> UnitId
 ue_currentUnit = ue_current_unit
 
+
 -- -------------------------------------------------------
 -- Operations on arbitrary elements of the home unit graph
 -- -------------------------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Unit/Module/Deps.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Unit/Module/Deps.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Unit/Module/Deps.hs  
2022-12-25 15:53:36.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Unit/Module/Deps.hs  
2023-04-30 02:46:47.000000000 +0200
@@ -256,6 +256,8 @@
   | UsageHomeModule {
         usg_mod_name :: ModuleName,
             -- ^ Name of the module
+        usg_unit_id :: UnitId,
+        -- ^ UnitId of the HomeUnit the module is from
         usg_mod_hash :: Fingerprint,
             -- ^ Cached module ABI fingerprint (corresponds to mi_mod_hash).
             -- This may be out dated after recompilation was avoided, but is
@@ -292,6 +294,8 @@
   | UsageHomeModuleInterface {
         usg_mod_name :: ModuleName
         -- ^ Name of the module
+        , usg_unit_id :: UnitId
+        -- ^ UnitId of the HomeUnit the module is from
         , usg_iface_hash :: Fingerprint
         -- ^ The *interface* hash of the module, not the ABI hash.
         -- This changes when anything about the interface (and hence the
@@ -331,6 +335,7 @@
     put_ bh usg@UsageHomeModule{} = do
         putByte bh 1
         put_ bh (usg_mod_name usg)
+        put_ bh (usg_unit_id  usg)
         put_ bh (usg_mod_hash usg)
         put_ bh (usg_exports  usg)
         put_ bh (usg_entities usg)
@@ -350,6 +355,7 @@
     put_ bh usg@UsageHomeModuleInterface{} = do
         putByte bh 4
         put_ bh (usg_mod_name usg)
+        put_ bh (usg_unit_id  usg)
         put_ bh (usg_iface_hash usg)
 
     get bh = do
@@ -362,11 +368,12 @@
             return UsagePackageModule { usg_mod = nm, usg_mod_hash = mod, 
usg_safe = safe }
           1 -> do
             nm    <- get bh
+            uid    <- get bh
             mod   <- get bh
             exps  <- get bh
             ents  <- get bh
             safe  <- get bh
-            return UsageHomeModule { usg_mod_name = nm, usg_mod_hash = mod,
+            return UsageHomeModule { usg_mod_name = nm, usg_mod_hash = mod, 
usg_unit_id = uid,
                      usg_exports = exps, usg_entities = ents, usg_safe = safe }
           2 -> do
             fp   <- get bh
@@ -379,8 +386,9 @@
             return UsageMergedRequirement { usg_mod = mod, usg_mod_hash = hash 
}
           4 -> do
             mod <- get bh
+            uid <- get bh
             hash <- get bh
-            return UsageHomeModuleInterface { usg_mod_name = mod, 
usg_iface_hash = hash }
+            return UsageHomeModuleInterface { usg_mod_name = mod, usg_unit_id 
= uid, usg_iface_hash = hash }
           i -> error ("Binary.get(Usage): " ++ show i)
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Unit/Module/Graph.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Unit/Module/Graph.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/GHC/Unit/Module/Graph.hs 
2022-12-25 15:53:36.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/GHC/Unit/Module/Graph.hs 
2023-04-30 02:46:47.000000000 +0200
@@ -99,7 +99,7 @@
 instance Outputable ModuleGraphNode where
   ppr = \case
     InstantiationNode _ iuid -> ppr iuid
-    ModuleNode nks ms -> ppr (ms_mnwib ms) <+> ppr nks
+    ModuleNode nks ms -> ppr (msKey ms) <+> ppr nks
     LinkNode uid _     -> text "LN:" <+> ppr uid
 
 instance Eq ModuleGraphNode where
@@ -126,8 +126,8 @@
 nodeKeyUnitId (NodeKey_Module mk) = mnkUnitId mk
 nodeKeyUnitId (NodeKey_Link uid)  = uid
 
-data ModNodeKeyWithUid = ModNodeKeyWithUid { mnkModuleName :: 
ModuleNameWithIsBoot
-                                           , mnkUnitId     :: UnitId } 
deriving (Eq, Ord)
+data ModNodeKeyWithUid = ModNodeKeyWithUid { mnkModuleName :: 
!ModuleNameWithIsBoot
+                                           , mnkUnitId     :: !UnitId } 
deriving (Eq, Ord)
 
 instance Outputable ModNodeKeyWithUid where
   ppr (ModNodeKeyWithUid mnwib uid) = ppr uid <> colon <> ppr mnwib
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/Language/Haskell/Syntax/Expr.hs 
new/ghc-lib-parser-9.4.5.20230430/compiler/Language/Haskell/Syntax/Expr.hs
--- old/ghc-lib-parser-9.4.4.20221225/compiler/Language/Haskell/Syntax/Expr.hs  
2022-12-25 15:53:36.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/Language/Haskell/Syntax/Expr.hs  
2023-04-30 02:46:47.000000000 +0200
@@ -1680,7 +1680,10 @@
   = FunRhs
     -- ^ A pattern matching on an argument of a
     -- function binding
-      { mc_fun        :: LIdP p    -- ^ function binder of @f@
+      { mc_fun        :: LIdP (NoGhcTc p)    -- ^ function binder of @f@
+                                             -- See Note [mc_fun field of 
FunRhs]
+                                             -- See #20415 for a long 
discussion about
+                                             -- this field and why it uses 
NoGhcTc.
       , mc_fixity     :: LexicalFixity -- ^ fixing of @f@
       , mc_strictness :: SrcStrictness -- ^ was @f@ banged?
                                        -- See Note [FunBind vs PatBind]
@@ -1707,6 +1710,21 @@
   | ThPatQuote             -- ^A Template Haskell pattern quotation [p| (a,b) 
|]
   | PatSyn                 -- ^A pattern synonym declaration
 
+{-
+Note [mc_fun field of FunRhs]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The mc_fun field of FunRhs has type `LIdP (NoGhcTc p)`, which means it will be
+a `RdrName` in pass `GhcPs`, a `Name` in `GhcRn`, and (importantly) still a
+`Name` in `GhcTc` -- not an `Id`.  See Note [NoGhcTc] in GHC.Hs.Extension.
+
+Why a `Name` in the typechecker phase?  Because:
+* A `Name` is all we need, as it turns out.
+* Using an `Id` involves knot-tying in the monad, which led to #22695.
+
+See #20415 for a long discussion.
+
+-}
+
 isPatSynCtxt :: HsMatchContext p -> Bool
 isPatSynCtxt ctxt =
   case ctxt of
@@ -1801,7 +1819,7 @@
 matchSeparator ThPatQuote   = panic "unused"
 matchSeparator PatSyn       = panic "unused"
 
-pprMatchContext :: (Outputable (IdP p), UnXRec p)
+pprMatchContext :: (Outputable (IdP (NoGhcTc p)), UnXRec (NoGhcTc p))
                 => HsMatchContext p -> SDoc
 pprMatchContext ctxt
   | want_an ctxt = text "an" <+> pprMatchContextNoun ctxt
@@ -1812,10 +1830,10 @@
     want_an (ArrowMatchCtxt KappaExpr) = True
     want_an _                          = False
 
-pprMatchContextNoun :: forall p. (Outputable (IdP p), UnXRec p)
+pprMatchContextNoun :: forall p. (Outputable (IdP (NoGhcTc p)), UnXRec 
(NoGhcTc p))
                     => HsMatchContext p -> SDoc
 pprMatchContextNoun (FunRhs {mc_fun=fun})   = text "equation for"
-                                              <+> quotes (ppr (unXRec @p fun))
+                                              <+> quotes (ppr (unXRec 
@(NoGhcTc p) fun))
 pprMatchContextNoun CaseAlt                 = text "case alternative"
 pprMatchContextNoun (LamCaseAlt lc_variant) = lamCaseKeyword lc_variant
                                               <+> text "alternative"
@@ -1831,10 +1849,10 @@
                                               $$ pprAStmtContext ctxt
 pprMatchContextNoun PatSyn                  = text "pattern synonym 
declaration"
 
-pprMatchContextNouns :: forall p. (Outputable (IdP p), UnXRec p)
+pprMatchContextNouns :: forall p. (Outputable (IdP (NoGhcTc p)), UnXRec 
(NoGhcTc p))
                      => HsMatchContext p -> SDoc
 pprMatchContextNouns (FunRhs {mc_fun=fun})   = text "equations for"
-                                               <+> quotes (ppr (unXRec @p fun))
+                                               <+> quotes (ppr (unXRec 
@(NoGhcTc p) fun))
 pprMatchContextNouns PatBindGuards           = text "pattern binding guards"
 pprMatchContextNouns (ArrowMatchCtxt c)      = pprArrowMatchContextNouns c
 pprMatchContextNouns (StmtCtxt ctxt)         = text "pattern bindings in"
@@ -1855,7 +1873,7 @@
 pprArrowMatchContextNouns ctxt                         = 
pprArrowMatchContextNoun ctxt <> char 's'
 
 -----------------
-pprAStmtContext, pprStmtContext :: (Outputable (IdP p), UnXRec p)
+pprAStmtContext, pprStmtContext :: (Outputable (IdP (NoGhcTc p)), UnXRec 
(NoGhcTc p))
                                 => HsStmtContext p -> SDoc
 pprAStmtContext (HsDoStmt flavour) = pprAHsDoFlavour flavour
 pprAStmtContext ctxt = text "a" <+> pprStmtContext ctxt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/cbits/keepCAFsForGHCi.c 
new/ghc-lib-parser-9.4.5.20230430/compiler/cbits/keepCAFsForGHCi.c
--- old/ghc-lib-parser-9.4.4.20221225/compiler/cbits/keepCAFsForGHCi.c  
1970-01-01 01:00:00.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/cbits/keepCAFsForGHCi.c  
2023-04-29 23:34:36.000000000 +0200
@@ -0,0 +1,35 @@
+#include <Rts.h>
+#include <ghcversion.h>
+
+// Note [keepCAFsForGHCi]
+// ~~~~~~~~~~~~~~~~~~~~~~
+// This file is only included in the dynamic library.
+// It contains an __attribute__((constructor)) function (run prior to main())
+// which sets the keepCAFs flag in the RTS, before any Haskell code is run.
+// This is required so that GHCi can use dynamic libraries instead of HSxyz.o
+// files.
+//
+// For static builds we have to guarantee that the linker loads this object 
file
+// to ensure the constructor gets run and not discarded. If the object is part 
of
+// an archive and not otherwise referenced the linker would ignore the object.
+// To avoid this:
+// * When initializing a GHC session in initGhcMonad we assert keeping cafs 
has been
+//   enabled by calling keepCAFsForGHCi.
+// * This causes the GHC module from the ghc package to carry a reference to 
this object
+//   file.
+// * Which in turn ensures the linker doesn't discard this object file, causing
+//   the constructor to be run, allowing the assertion to succeed in the first 
place
+//   as keepCAFs will have been set already during initialization of 
constructors.
+
+
+
+bool keepCAFsForGHCi(void) __attribute__((constructor));
+
+bool keepCAFsForGHCi(void)
+{
+    bool was_set = keepCAFs;
+    setKeepCAFs();
+    return was_set;
+}
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/compiler/ghc-llvm-version.h 
new/ghc-lib-parser-9.4.5.20230430/compiler/ghc-llvm-version.h
--- old/ghc-lib-parser-9.4.4.20221225/compiler/ghc-llvm-version.h       
2022-12-25 15:53:06.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/compiler/ghc-llvm-version.h       
2023-04-30 02:46:19.000000000 +0200
@@ -3,7 +3,7 @@
 #define __GHC_LLVM_VERSION_H__
 
 /* The maximum supported LLVM version number */
-#define sUPPORTED_LLVM_VERSION_MAX (14)
+#define sUPPORTED_LLVM_VERSION_MAX (15)
 
 /* The minimum supported LLVM version number */
 #define sUPPORTED_LLVM_VERSION_MIN (10)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/ghc-lib/stage0/compiler/build/GHC/Settings/Config.hs
 
new/ghc-lib-parser-9.4.5.20230430/ghc-lib/stage0/compiler/build/GHC/Settings/Config.hs
--- 
old/ghc-lib-parser-9.4.4.20221225/ghc-lib/stage0/compiler/build/GHC/Settings/Config.hs
      2022-12-25 15:53:36.000000000 +0100
+++ 
new/ghc-lib-parser-9.4.5.20230430/ghc-lib/stage0/compiler/build/GHC/Settings/Config.hs
      2023-04-30 02:46:47.000000000 +0200
@@ -21,7 +21,7 @@
 cProjectName          = "The Glorious Glasgow Haskell Compilation System"
 
 cBooterVersion        :: String
-cBooterVersion        = "9.2.2"
+cBooterVersion        = "9.2.5"
 
 cStage                :: String
 cStage                = show (1 :: Int)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/ghc-lib/stage0/lib/settings 
new/ghc-lib-parser-9.4.5.20230430/ghc-lib/stage0/lib/settings
--- old/ghc-lib-parser-9.4.4.20221225/ghc-lib/stage0/lib/settings       
2022-12-25 15:53:20.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/ghc-lib/stage0/lib/settings       
2023-04-30 02:46:31.000000000 +0200
@@ -3,7 +3,7 @@
 ,("C compiler flags", "--target=x86_64-apple-darwin ")
 ,("C++ compiler command", "/usr/bin/g++")
 ,("C++ compiler flags", "--target=x86_64-apple-darwin ")
-,("C compiler link flags", "--target=x86_64-apple-darwin  ")
+,("C compiler link flags", "--target=x86_64-apple-darwin -Wl,-no_fixup_chains")
 ,("C compiler supports -no-pie", "NO")
 ,("Haskell CPP command", "/usr/bin/gcc")
 ,("Haskell CPP flags", "-E -undef -traditional -Wno-invalid-pp-token 
-Wno-unicode -Wno-trigraphs")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/ghc-lib/stage0/libraries/ghc-boot/build/GHC/Version.hs
 
new/ghc-lib-parser-9.4.5.20230430/ghc-lib/stage0/libraries/ghc-boot/build/GHC/Version.hs
--- 
old/ghc-lib-parser-9.4.4.20221225/ghc-lib/stage0/libraries/ghc-boot/build/GHC/Version.hs
    2022-12-25 15:53:20.000000000 +0100
+++ 
new/ghc-lib-parser-9.4.5.20230430/ghc-lib/stage0/libraries/ghc-boot/build/GHC/Version.hs
    2023-04-30 02:46:31.000000000 +0200
@@ -3,19 +3,19 @@
 import Prelude -- See Note [Why do we import Prelude here?]
 
 cProjectGitCommitId   :: String
-cProjectGitCommitId   = "cafe75946c465dd20c324918807464e09f12ac2f"
+cProjectGitCommitId   = "a213d3676550a0e4d542172de539c0cfa2662431"
 
 cProjectVersion       :: String
-cProjectVersion       = "9.4.4"
+cProjectVersion       = "9.4.5"
 
 cProjectVersionInt    :: String
 cProjectVersionInt    = "904"
 
 cProjectPatchLevel    :: String
-cProjectPatchLevel    = "4"
+cProjectPatchLevel    = "5"
 
 cProjectPatchLevel1   :: String
-cProjectPatchLevel1   = "4"
+cProjectPatchLevel1   = "5"
 
 cProjectPatchLevel2   :: String
 cProjectPatchLevel2   = "0"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/ghc-lib/stage0/rts/build/include/GhclibDerivedConstants.h
 
new/ghc-lib-parser-9.4.5.20230430/ghc-lib/stage0/rts/build/include/GhclibDerivedConstants.h
--- 
old/ghc-lib-parser-9.4.4.20221225/ghc-lib/stage0/rts/build/include/GhclibDerivedConstants.h
 2022-12-25 15:53:35.000000000 +0100
+++ 
new/ghc-lib-parser-9.4.5.20230430/ghc-lib/stage0/rts/build/include/GhclibDerivedConstants.h
 2023-04-30 02:46:45.000000000 +0200
@@ -68,29 +68,29 @@
 #define OFFSET_stgGCEnter1 -16
 #define OFFSET_stgGCFun -8
 #define OFFSET_Capability_r 24
-#define OFFSET_Capability_lock 1216
+#define OFFSET_Capability_lock 1224
 #define OFFSET_Capability_no 944
 #define REP_Capability_no b32
 #define Capability_no(__ptr__) REP_Capability_no[__ptr__+OFFSET_Capability_no]
 #define OFFSET_Capability_mut_lists 1016
 #define REP_Capability_mut_lists b64
 #define Capability_mut_lists(__ptr__) 
REP_Capability_mut_lists[__ptr__+OFFSET_Capability_mut_lists]
-#define OFFSET_Capability_context_switch 1184
+#define OFFSET_Capability_context_switch 1192
 #define REP_Capability_context_switch b32
 #define Capability_context_switch(__ptr__) 
REP_Capability_context_switch[__ptr__+OFFSET_Capability_context_switch]
-#define OFFSET_Capability_interrupt 1188
+#define OFFSET_Capability_interrupt 1196
 #define REP_Capability_interrupt b32
 #define Capability_interrupt(__ptr__) 
REP_Capability_interrupt[__ptr__+OFFSET_Capability_interrupt]
-#define OFFSET_Capability_sparks 1320
+#define OFFSET_Capability_sparks 1328
 #define REP_Capability_sparks b64
 #define Capability_sparks(__ptr__) 
REP_Capability_sparks[__ptr__+OFFSET_Capability_sparks]
-#define OFFSET_Capability_total_allocated 1192
+#define OFFSET_Capability_total_allocated 1200
 #define REP_Capability_total_allocated b64
 #define Capability_total_allocated(__ptr__) 
REP_Capability_total_allocated[__ptr__+OFFSET_Capability_total_allocated]
-#define OFFSET_Capability_weak_ptr_list_hd 1168
+#define OFFSET_Capability_weak_ptr_list_hd 1176
 #define REP_Capability_weak_ptr_list_hd b64
 #define Capability_weak_ptr_list_hd(__ptr__) 
REP_Capability_weak_ptr_list_hd[__ptr__+OFFSET_Capability_weak_ptr_list_hd]
-#define OFFSET_Capability_weak_ptr_list_tl 1176
+#define OFFSET_Capability_weak_ptr_list_tl 1184
 #define REP_Capability_weak_ptr_list_tl b64
 #define Capability_weak_ptr_list_tl(__ptr__) 
REP_Capability_weak_ptr_list_tl[__ptr__+OFFSET_Capability_weak_ptr_list_tl]
 #define OFFSET_bdescr_start 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/ghc-lib/stage0/rts/build/include/ghcautoconf.h
 
new/ghc-lib-parser-9.4.5.20230430/ghc-lib/stage0/rts/build/include/ghcautoconf.h
--- 
old/ghc-lib-parser-9.4.4.20221225/ghc-lib/stage0/rts/build/include/ghcautoconf.h
    2022-12-25 15:53:20.000000000 +0100
+++ 
new/ghc-lib-parser-9.4.5.20230430/ghc-lib/stage0/rts/build/include/ghcautoconf.h
    2023-04-30 02:46:31.000000000 +0200
@@ -204,9 +204,6 @@
 /* Define to 1 if the system has the type `long long'. */
 #define HAVE_LONG_LONG 1
 
-/* Define to 1 if you have the mingwex library. */
-/* #undef HAVE_MINGWEX */
-
 /* Define to 1 if you have the <minix/config.h> header file. */
 /* #undef HAVE_MINIX_CONFIG_H */
 
@@ -626,7 +623,7 @@
 /* #undef pid_t */
 
 /* The maximum supported LLVM version number */
-#define sUPPORTED_LLVM_VERSION_MAX (14)
+#define sUPPORTED_LLVM_VERSION_MAX (15)
 
 /* The minimum supported LLVM version number */
 #define sUPPORTED_LLVM_VERSION_MIN (10)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ghc-lib-parser-9.4.4.20221225/ghc-lib-parser.cabal 
new/ghc-lib-parser-9.4.5.20230430/ghc-lib-parser.cabal
--- old/ghc-lib-parser-9.4.4.20221225/ghc-lib-parser.cabal      2022-12-25 
15:53:41.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/ghc-lib-parser.cabal      2023-04-30 
02:46:52.000000000 +0200
@@ -1,7 +1,7 @@
 cabal-version: 2.0
 build-type: Simple
 name: ghc-lib-parser
-version: 9.4.4.20221225
+version: 9.4.5.20230430
 license: BSD3
 license-file: LICENSE
 category: Development
@@ -37,9 +37,9 @@
     ghc-lib/stage0/compiler/build/primop-vector-uniques.hs-incl
     ghc-lib/stage0/compiler/build/primop-docs.hs-incl
     ghc-lib/stage0/compiler/build/GHC/Platform/Constants.hs
+    ghc-lib/stage0/compiler/build/GHC/Settings/Config.hs
     ghc-lib/stage0/libraries/ghc-boot/build/GHC/Version.hs
     ghc-lib/stage0/libraries/ghc-boot/build/GHC/Platform/Host.hs
-    ghc-lib/stage0/compiler/build/GHC/Settings/Config.hs
     compiler/GHC/Parser.y
     compiler/GHC/Parser/Lexer.x
     compiler/GHC/Parser/HaddockLex.x
@@ -55,7 +55,10 @@
 source-repository head
     type: git
     location: g...@github.com:digital-asset/ghc-lib.git
-
+flag threaded-rts
+  default: True
+  manual: True
+  description: Pass -DTHREADED_RTS to the C toolchain
 library
     default-language:   Haskell2010
     exposed: False
@@ -64,9 +67,13 @@
         ghc-lib/stage0/lib
         ghc-lib/stage0/compiler/build
         compiler
-    ghc-options: -fobject-code -package=ghc-boot-th -optc-DTHREADED_RTS
-    cc-options: -DTHREADED_RTS
-    cpp-options:  -DTHREADED_RTS
+    if flag(threaded-rts)
+        ghc-options: -fobject-code -package=ghc-boot-th -optc-DTHREADED_RTS
+        cc-options: -DTHREADED_RTS
+        cpp-options: -DTHREADED_RTS
+    else
+        ghc-options: -fobject-code -package=ghc-boot-th
+        cpp-options:
     if !os(windows)
         build-depends: unix
     else
@@ -85,7 +92,7 @@
         array >= 0.1 && < 0.6,
         deepseq >= 1.4 && < 1.5,
         pretty == 1.1.*,
-        transformers == 0.5.*,
+        transformers >= 0.5 && < 0.7,
         process >= 1 && < 1.7
     build-tool-depends: alex:alex >= 3.1, happy:happy >= 1.19.4
     other-extensions:
@@ -131,6 +138,7 @@
         libraries/ghc-heap/cbits/HeapPrim.cmm
         compiler/cbits/genSym.c
         compiler/cbits/cutils.c
+        compiler/cbits/keepCAFsForGHCi.c
     hs-source-dirs:
         ghc-lib/stage0/libraries/ghc-boot/build
         ghc-lib/stage0/compiler/build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ghc-lib-parser-9.4.4.20221225/libraries/ghci/GHCi/Message.hs 
new/ghc-lib-parser-9.4.5.20230430/libraries/ghci/GHCi/Message.hs
--- old/ghc-lib-parser-9.4.4.20221225/libraries/ghci/GHCi/Message.hs    
2022-12-25 15:53:36.000000000 +0100
+++ new/ghc-lib-parser-9.4.5.20230430/libraries/ghci/GHCi/Message.hs    
2023-04-30 02:46:47.000000000 +0200
@@ -465,7 +465,7 @@
 #define MIN_VERSION_ghc_heap(major1,major2,minor) (\
   (major1) <  9 || \
   (major1) == 9 && (major2) <  4 || \
-  (major1) == 9 && (major2) == 4 && (minor) <= 4)
+  (major1) == 9 && (major2) == 4 && (minor) <= 5)
 #endif /* MIN_VERSION_ghc_heap */
 #if MIN_VERSION_ghc_heap(8,11,0)
 instance Binary Heap.StgTSOProfInfo

Reply via email to