[Git][ghc/ghc][wip/26805] Fix two bugs in short-cut constraint solving
by Simon Peyton Jones (ļ¼ simonpj) 23 Jan '26
by Simon Peyton Jones (ļ¼ simonpj) 23 Jan '26
23 Jan '26
Simon Peyton Jones pushed to branch wip/26805 at Glasgow Haskell Compiler / GHC
Commits:
3ff419a9 by Simon Peyton Jones at 2026-01-23T17:45:02+00:00
Fix two bugs in short-cut constraint solving
There are two main changes here:
* Use `isSolvedWC` rather than `isEmptyWC` in `tryShortCutSolver`
The residual constraint may have some fully-solved, but
still-there implications, and we don't want them to abort short
cut solving! That bug caused #26805.
* In the short-cut solver, we abandon the fully-solved residual
constraint; but we may thereby lose track of Givens that are
needed, and either report them as redundant or prune evidence
bindings that are in fact needed.
This bug stopped the `constraints` package from compiling;
see the trail in !15389.
The second bug led me to (another) significant refactoring
of the mechanism for tracking needed EvIds. See the new
Note [Tracking needed EvIds] in GHC.Tc.Solver.Solve
It's simpler and much less head-scratchy now.
Some particulars:
* An EvBindsVar now tracks NeededEvIds
* We deal with NeededEvIds for an implication only when it is
fully solved. Much simpler!
* `tryShortCutTcS` now takes a `TcM WantedConstraints` rather than
`TcM Bool`, so that is can plumb the needed EvIds correctly.
* Remove `ic_need` and `ic_need_implic` from Implication (hooray),
and add `ics_dm` and `ics_non_dm` to `IC_Solved`.
Pure refactor
* Shorten data constructor `CoercionHole` to `CH`, following
general practice in GHC.
* Rename `EvBindMap` to `EvBindsMap` for consistency
- - - - -
28 changed files:
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/TyCo/Tidy.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Gen/Default.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Solver/Default.hs
- compiler/GHC/Tc/Solver/Dict.hs
- compiler/GHC/Tc/Solver/Equality.hs
- compiler/GHC/Tc/Solver/InertSet.hs
- compiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/Solver/Solve.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/Types/Constraint.hs
- compiler/GHC/Tc/Types/Evidence.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Tc/Utils/Unify.hs
- compiler/GHC/Tc/Zonk/TcType.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/Types/Var.hs
- compiler/GHC/Utils/Trace.hs
- + testsuite/tests/simplCore/should_compile/T26805.hs
- + testsuite/tests/simplCore/should_compile/T26805.stderr
- testsuite/tests/simplCore/should_compile/all.T
- + testsuite/tests/typecheck/should_compile/T26805a.hs
- testsuite/tests/typecheck/should_compile/all.T
Changes:
=====================================
compiler/GHC/Core/TyCo/Rep.hs
=====================================
@@ -1688,11 +1688,9 @@ holes `HoleCo`, which get filled in later.
-- | A coercion to be filled in by the type-checker. See Note [Coercion holes]
data CoercionHole
- = CoercionHole { ch_co_var :: CoVar
- -- See Note [Coercion holes] wrinkle (COH2)
-
- , ch_ref :: IORef (Maybe CoercionPlusHoles)
- }
+ = CH { ch_co_var :: CoVar -- See Note [Coercion holes] wrinkle (COH2)
+ , ch_ref :: IORef (Maybe CoercionPlusHoles)
+ }
data CoercionPlusHoles
= CPH { cph_co :: Coercion
@@ -1714,7 +1712,7 @@ instance Data.Data CoercionHole where
dataTypeOf _ = mkNoRepType "CoercionHole"
instance Outputable CoercionHole where
- ppr (CoercionHole { ch_co_var = cv }) = braces (ppr cv)
+ ppr (CH { ch_co_var = cv }) = braces (ppr cv)
instance Outputable CoercionPlusHoles where
ppr (CPH { cph_co = co, cph_holes = holes })
@@ -1723,7 +1721,7 @@ instance Outputable CoercionPlusHoles where
, text "cph_holes =" <+> ppr holes ])
instance Uniquable CoercionHole where
- getUnique (CoercionHole { ch_co_var = cv }) = getUnique cv
+ getUnique (CH { ch_co_var = cv }) = getUnique cv
-- | A CoHoleSet stores a set of CoercionHoles that have been used to rewrite
=====================================
compiler/GHC/Core/TyCo/Subst.hs
=====================================
@@ -892,8 +892,7 @@ subst_co subst co
in cos' `seqList` cos'
-- See Note [Substituting in a coercion hole]
- go_hole h@(CoercionHole { ch_co_var = cv })
- = h { ch_co_var = updateVarType go_ty cv }
+ go_hole h@(CH { ch_co_var = cv }) = h { ch_co_var = updateVarType go_ty cv }
-- | Perform a substitution within a 'DVarSet' of free variables,
-- returning the shallow free coercion variables.
=====================================
compiler/GHC/Core/TyCo/Tidy.hs
=====================================
@@ -357,7 +357,7 @@ tidyCo env co
go_cv cv = tidyTyCoVarOcc env cv
- go_hole (CoercionHole cv r) = (CoercionHole $! go_cv cv) r
+ go_hole (CH cv r) = (CH $! go_cv cv) r
-- Tidy even the holes; tidied types should have tidied kinds
tidyCos :: TidyEnv -> [Coercion] -> [Coercion]
=====================================
compiler/GHC/Tc/Errors.hs
=====================================
@@ -399,7 +399,7 @@ reportImplic ctxt implic@(Implic { ic_skols = tvs
_ -> False
warnRedundantConstraints :: SolverReportErrCtxt -> CtLocEnv -> SkolemInfoAnon -> [EvVar] -> TcM ()
--- See Note [Tracking redundant constraints] in GHC.Tc.Solver
+-- See Note [Tracking needed EvIds] in GHC.Tc.Solver
warnRedundantConstraints ctxt env info redundant_evs
| not (cec_warn_redundant ctxt)
= return ()
=====================================
compiler/GHC/Tc/Gen/Default.hs
=====================================
@@ -22,7 +22,7 @@ import GHC.Tc.Errors.Types
import GHC.Tc.Gen.HsType
import GHC.Tc.Solver.Monad ( runTcS )
import GHC.Tc.Solver.Solve ( solveWanteds )
-import GHC.Tc.Types.Constraint ( isEmptyWC, andWC, mkSimpleWC )
+import GHC.Tc.Types.Constraint ( isSolvedWC, andWC, mkSimpleWC )
import GHC.Tc.Types.Origin ( CtOrigin(DefaultOrigin) )
import GHC.Tc.Utils.Env
import GHC.Tc.Utils.Monad
@@ -296,7 +296,7 @@ simplifyDefault cls dflt_ty@(L l _)
, text "inst_pred:" <+> ppr inst_pred
, text "all_wanteds " <+> ppr all_wanteds
, text "unsolved:" <+> ppr unsolved ]
- ; let is_instance = isEmptyWC unsolved
+ ; let is_instance = isSolvedWC unsolved
; return $
if | is_instance
, ClassPred _ tys <- classifyPredType inst_pred
=====================================
compiler/GHC/Tc/Gen/Expr.hs
=====================================
@@ -199,6 +199,9 @@ tcPolyExprCheck expr res_ty
-> TcM (HsExpr GhcTc)
outer_skolemise (Left ty) thing_inside
= do { (wrap, expr') <- tcSkolemiseExpectedType ty thing_inside
+ ; traceTc "outer_skol" (vcat [ text "wrap" <+> ppr wrap
+ , text "expr'" <+> ppr expr'
+ , text "wrapped" <+> ppr (mkHsWrap wrap expr') ])
; return (mkHsWrap wrap expr') }
outer_skolemise (Right sig) thing_inside
= do { (wrap, expr') <- tcSkolemiseCompleteSig sig thing_inside
=====================================
compiler/GHC/Tc/Solver/Default.hs
=====================================
@@ -272,10 +272,9 @@ unsatisfiableEv_maybe v = (v,) <$> isUnsatisfiableCt_maybe (idType v)
-- solve all the other Wanted constraints, including those nested within
-- deeper implications.
solveImplicationUsingUnsatGiven :: (EvVar, Type) -> Implication -> TcS Implication
-solveImplicationUsingUnsatGiven
- unsat_given@(given_ev,_)
+solveImplicationUsingUnsatGiven unsat_given
impl@(Implic { ic_wanted = wtd, ic_tclvl = tclvl, ic_binds = ev_binds_var
- , ic_need_implic = inner, ic_info = skol_info })
+ , ic_info = skol_info })
| isCoEvBindsVar ev_binds_var
-- We can't use Unsatisfiable evidence in kinds.
-- See Note [Coercion evidence only] in GHC.Tc.Types.Evidence.
@@ -283,9 +282,7 @@ solveImplicationUsingUnsatGiven
| otherwise
= do { wcs <- nestImplicTcS skol_info ev_binds_var tclvl $ go_wc wtd
; setImplicationStatus $
- impl { ic_wanted = wcs
- , ic_need_implic = inner `extendEvNeedSet` given_ev } }
- -- Record that the Given is needed; I'm not certain why
+ impl { ic_wanted = wcs } }
where
go_wc :: WantedConstraints -> TcS WantedConstraints
go_wc wc@(WC { wc_simple = wtds, wc_impl = impls })
=====================================
compiler/GHC/Tc/Solver/Dict.hs
=====================================
@@ -663,6 +663,12 @@ Some wrinkles:
of the caller (#15164). You might worry about having a solved-dict that uses
a Given -- but that too will have been subject to short-cut solving so it's fine.
+(SCS4) In `tryShortCutSolver`, when deciding if we have "completely solved" the
+ constraint, we must use `isSolvedWC` not `isEmptyWC`. The latter says "False"
+ if the residual constraint has any implications, even solved ones; and we
+ don't want to reject short-cut solving just because we have some leftover
+ /solved/ implications. #26805 was a case in point.
+
Note [Shortcut solving: incoherence]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This optimization relies on coherence of dictionaries to be correct. When we
@@ -742,7 +748,8 @@ try_inert_dicts inerts dict_w@(DictCt { di_ev = ev_w, di_cls = cls, di_tys = tys
= -- There is a matching dictionary in the inert set
do { -- For a Wanted, first to try to solve it /completely/ from top level instances
-- See Note [Shortcut solving]
- ; short_cut_worked <- tryShortCutSolver (isGiven ev_i) dict_w
+ ; dflags <- getDynFlags
+ ; short_cut_worked <- tryShortCutSolver dflags (isGiven ev_i) dict_w
; if | short_cut_worked
-> stopWith ev_w "shortCutSolver worked(1)"
@@ -770,7 +777,8 @@ try_inert_dicts inerts dict_w@(DictCt { di_ev = ev_w, di_cls = cls, di_tys = tys
; continueWith () }
-- See Note [Shortcut solving]
-tryShortCutSolver :: Bool -- True <=> try the short-cut solver; False <=> don't
+tryShortCutSolver :: DynFlags
+ -> Bool -- True <=> try the short-cut solver; False <=> don't
-> DictCt -- Work item
-> TcS Bool -- True <=> success
-- We are about to solve a [W] constraint from a [G] constraint. We take
@@ -778,30 +786,25 @@ tryShortCutSolver :: Bool -- True <=> try the short-cut solver; False <=>
-- Note that we only do this for the sake of performance. Exactly the same
-- programs should typecheck regardless of whether we take this step or
-- not. See Note [Shortcut solving]
-tryShortCutSolver try_short_cut dict_w@(DictCt { di_ev = ev_w })
- | not try_short_cut
- = return False
- | otherwise
- = do { dflags <- getDynFlags
- ; if | CtWanted (WantedCt { ctev_pred = pred_w }) <- ev_w
-
- , not (couldBeIPLike pred_w) -- Not for implicit parameters (#18627)
+tryShortCutSolver dflags try_short_cut dict_w
+ | try_short_cut
+ , DictCt { di_ev = ev_w } <- dict_w
+ , CtWanted (WantedCt { ctev_pred = pred_w }) <- ev_w
+ , not (couldBeIPLike pred_w) -- Not for implicit parameters (#18627)
- , not (xopt LangExt.IncoherentInstances dflags)
+ , not (xopt LangExt.IncoherentInstances dflags)
-- If IncoherentInstances is on then we cannot rely on coherence of proofs
-- in order to justify this optimization: The proof provided by the
-- [G] constraint's superclass may be different from the top-level proof.
-- See Note [Shortcut solving: incoherence]
-
- , gopt Opt_SolveConstantDicts dflags
+ , gopt Opt_SolveConstantDicts dflags
-- Enabled by the -fsolve-constant-dicts flag
- -> tryShortCutTcS $ -- tryTcS tries to completely solve some contraints
- do { residual <- solveSimpleWanteds (unitBag (CDictCan dict_w))
- ; return (isEmptyWC residual) }
+ = tryShortCutTcS $ -- tryTcS tries to completely solve some contraints
+ solveSimpleWanteds (unitBag (CDictCan dict_w))
- | otherwise
- -> return False }
+ | otherwise
+ = return False
{- *******************************************************************
@@ -836,7 +839,7 @@ try_instances inerts work_item@(DictCt { di_ev = ev@(CtWanted wev), di_cls = cls
; case lkup_res of
OneInst { cir_what = what }
-> do { let is_local_given = case what of { LocalInstance -> True; _ -> False }
- ; take_shortcut <- tryShortCutSolver is_local_given work_item
+ ; take_shortcut <- tryShortCutSolver dflags is_local_given work_item
; if take_shortcut
then stopWith ev "shortCutSolver worked(2)"
else do { insertSafeOverlapFailureTcS what work_item
=====================================
compiler/GHC/Tc/Solver/Equality.hs
=====================================
@@ -601,7 +601,7 @@ can_eq_nc_forall ev eq_rel s1 s2
-- they are kept alive by `neededEvVars`. Admittedly they are free in `all_co`,
-- but only if we zonk it, which `neededEvVars` does not do (see test T7196).
ev_binds_var <- getTcEvBindsVar
- ; updTcEvBinds ev_binds_var nested_ev_binds_var
+ ; combineTcEvBinds ev_binds_var nested_ev_binds_var
; setWantedEq orig_dest (CPH { cph_co = all_co, cph_holes = emptyCoHoleSet })
-- emptyCoHoleSet: fully solved, so all_co has no holes
=====================================
compiler/GHC/Tc/Solver/InertSet.hs
=====================================
@@ -2127,7 +2127,7 @@ solveOneFromTheOther.
- For everything else, we want to keep the outermost one. Reason: that
makes it more likely that the inner one will turn out to be unused,
- and can be reported as redundant. See Note [Tracking redundant constraints]
+ and can be reported as redundant. See Note [Tracking needed EvIds]
in GHC.Tc.Solver.
It transpires that using the outermost one is responsible for an
@@ -2140,7 +2140,7 @@ solveOneFromTheOther.
according to Note [Solving superclass constraints] in GHC.Tc.TyCl.Instance.
(b) Prefer constraints that are not superclass selections. See
- (TRC3) in Note [Tracking redundant constraints] in GHC.Tc.Solver.
+ (TRC3) in Note [Tracking needed EvIds] in GHC.Tc.Solver.
(c) If both are GivenSCOrigin, chooose the one with the shallower
superclass-selection depth, in the hope of identifying more correct
=====================================
compiler/GHC/Tc/Solver/Monad.hs
=====================================
@@ -15,7 +15,7 @@ module GHC.Tc.Solver.Monad (
failTcS, warnTcS, addErrTcS, wrapTcS, ctLocWarnTcS,
runTcSEqualities,
nestTcS, nestImplicTcS, tryShortCutTcS, nestFunDepsTcS,
- setEvBindsTcS, setTcLevelTcS, updTcEvBinds,
+ setEvBindsTcS, setTcLevelTcS,
selectNextWorkItem,
getWorkList,
@@ -58,7 +58,7 @@ module GHC.Tc.Solver.Monad (
getInstEnvs, getFamInstEnvs, -- Getting the environments
getTopEnv, getGblEnv, getLclEnv, setSrcSpan,
getTcEvBindsVar, getTcLevel,
- getTcEvTyCoVars, getTcEvBindsMap, setTcEvBindsMap,
+ getTcEvBindsMap, setTcEvBindsMap, getTcEvBindsState, combineTcEvBinds,
tcLookupClass, tcLookupId, tcLookupTyCon,
-- Inerts
@@ -1140,7 +1140,7 @@ csTraceTcM mk_doc
{-# INLINE csTraceTcM #-} -- see Note [INLINE conditional tracing utilities]
runTcS :: TcS a -- What to run
- -> TcM (a, EvBindMap)
+ -> TcM (a, EvBindsMap)
runTcS tcs
= do { ev_binds_var <- TcM.newTcEvBinds
; res <- runTcSWithEvBinds ev_binds_var tcs
@@ -1222,7 +1222,7 @@ runTcSWithEvBinds' mode ev_binds_var thing_inside
----------------------------
#if defined(DEBUG)
-checkForCyclicBinds :: EvBindMap -> TcM ()
+checkForCyclicBinds :: EvBindsMap -> TcM ()
checkForCyclicBinds ev_binds_map
| null cycles
= return ()
@@ -1351,7 +1351,7 @@ nestTcS (TcS thing_inside)
; return res }
-tryShortCutTcS :: TcS Bool -> TcS Bool
+tryShortCutTcS :: TcS WantedConstraints -> TcS Bool
-- Like nestTcS, but
-- (a) be a no-op if the nested computation returns False
-- (b) if (but only if) success, propagate nested bindings to the caller
@@ -1380,26 +1380,43 @@ tryShortCutTcS (TcS thing_inside)
, tcs_inerts = new_inert_var
, tcs_worklist = new_wl_var }
- ; TcM.traceTc "tryTcS {" $
+ ; TcM.traceTc "tryShortCutTcS {" $
vcat [ text "old_ev_binds:" <+> ppr old_ev_binds_var
, text "new_ev_binds:" <+> ppr new_ev_binds_var
, ppr old_inerts ]
- ; solved <- thing_inside nest_env
- ; TcM.traceTc "tryTcS }" (ppr solved)
-
- ; if not solved
- then return False
- else do { -- Successfully solved
- -- Add the new bindings to the existing ones
- ; TcM.updTcEvBinds old_ev_binds_var new_ev_binds_var
-
- -- Update the existing inert set
- ; new_inerts <- TcM.readTcRef new_inert_var
- ; TcM.updTcRef inerts_var (`updateInertsWith` new_inerts)
-
- ; TcM.traceTc "tryTcS update" (ppr (inert_solved_dicts new_inerts))
-
- ; return True } }
+ ; residual <- thing_inside nest_env
+ ; let solved = isSolvedWC residual
+ -- NB: isSolvedWC, not isEmptyWC (#26805). We might succeed
+ -- in fully-solving the constraint but still leave some
+ -- /solved/ implications in the residual.
+ -- See (SCS4) in Note [Shortcut solving]
+ ; TcM.traceTc "tryShortCutTcS }" (ppr solved)
+
+ ; when solved $ -- Successfully solved
+ do { -- Add the new bindings to the existing ones
+ ; TcM.combineTcEvBinds old_ev_binds_var new_ev_binds_var
+
+ -- We are discarding some implications; we must add their
+ -- NeededEvIds to the current bindings, lest we fail to record
+ -- some needed givens, and then wrongly prune away their bindings
+ ; TcM.addNeededEvIds old_ev_binds_var $
+ foldr add_implic emptyVarSet $
+ wc_impl residual
+
+ -- Update the existing inert set
+ ; new_inerts <- TcM.readTcRef new_inert_var
+ ; TcM.updTcRef inerts_var (`updateInertsWith` new_inerts) }
+
+
+ ; return solved
+ }
+ where
+ add_implic :: Implication -> NeededEvIds -> NeededEvIds
+ add_implic implic@(Implic { ic_status = status }) needs
+ | IC_Solved { ics_dm = dm, ics_non_dm = non_dm } <- status
+ = needs `unionVarSet` dm `unionVarSet` non_dm
+ | otherwise
+ = pprPanic "tryShortCutTcS" (ppr implic)
updateInertsWith :: InertSet -> InertSet -> InertSet
-- Update the current inert set with bits from a nested solve,
@@ -1465,21 +1482,21 @@ getTcEvBindsVar = TcS (return . tcs_ev_binds)
getTcLevel :: TcS TcLevel
getTcLevel = wrapTcS TcM.getTcLevel
-getTcEvTyCoVars :: EvBindsVar -> TcS [TcCoercion]
-getTcEvTyCoVars ev_binds_var
- = wrapTcS $ TcM.getTcEvTyCoVars ev_binds_var
+getTcEvBindsState :: EvBindsVar -> TcS EvBindsState
+getTcEvBindsState ev_binds_var
+ = wrapTcS $ TcM.getTcEvBindsState ev_binds_var
-getTcEvBindsMap :: EvBindsVar -> TcS EvBindMap
+getTcEvBindsMap :: EvBindsVar -> TcS EvBindsMap
getTcEvBindsMap ev_binds_var
= wrapTcS $ TcM.getTcEvBindsMap ev_binds_var
-setTcEvBindsMap :: EvBindsVar -> EvBindMap -> TcS ()
+setTcEvBindsMap :: EvBindsVar -> EvBindsMap -> TcS ()
setTcEvBindsMap ev_binds_var binds
= wrapTcS $ TcM.setTcEvBindsMap ev_binds_var binds
-updTcEvBinds :: EvBindsVar -> EvBindsVar -> TcS ()
-updTcEvBinds evb nested_evb
- = wrapTcS $ TcM.updTcEvBinds evb nested_evb
+combineTcEvBinds :: EvBindsVar -> EvBindsVar -> TcS ()
+combineTcEvBinds evb nested_evb
+ = wrapTcS $ TcM.combineTcEvBinds evb nested_evb
getDefaultInfo :: TcS (DefaultEnv, Bool)
getDefaultInfo = wrapTcS TcM.tcGetDefaultTys
@@ -2029,12 +2046,9 @@ setWantedDict dest canonical tm
HoleDest h -> pprPanic "setWantedEq: HoleDest" (ppr h)
fillCoercionHole :: CoercionHole -> CoercionPlusHoles -> TcS ()
-fillCoercionHole hole co_plus_holes@(CPH { cph_co = co })
+fillCoercionHole hole co_plus_holes
= do { ev_binds_var <- getTcEvBindsVar
- ; wrapTcS $ do { -- Record usage of the free vars of this coercion
- TcM.updTcRef (ebv_tcvs ev_binds_var) (co :)
- ; -- Fill the hole
- TcM.fillCoercionHole hole co_plus_holes }
+ ; wrapTcS $ TcM.addTcEvCoBind ev_binds_var hole co_plus_holes
; kickOutAfterFillingCoercionHole hole co_plus_holes }
newTcEvBinds :: TcS EvBindsVar
=====================================
compiler/GHC/Tc/Solver/Solve.hs
=====================================
@@ -33,7 +33,6 @@ import qualified GHC.Tc.Zonk.TcType as TcM
import GHC.Core.Predicate
import GHC.Core.Reduction
import GHC.Core.Coercion
-import GHC.Core.TyCo.FVs( coVarsOfCos )
import GHC.Core.Class( classHasSCs )
import GHC.Types.Id( idType )
@@ -432,12 +431,10 @@ solveImplication imp@(Implic { ic_tclvl = tclvl
, ic_wanted = final_wanted })
; evbinds <- TcS.getTcEvBindsMap ev_binds_var
- ; tcvs <- TcS.getTcEvTyCoVars ev_binds_var
; traceTcS "solveImplication end }" $ vcat
[ text "has_given_eqs =" <+> ppr has_given_eqs
, text "res_implic =" <+> ppr res_implic
- , text "implication evbinds =" <+> ppr (evBindMapBinds evbinds)
- , text "implication tvcs =" <+> ppr tcvs ]
+ , text "evbinds =" <+> ppr evbinds ]
; return res_implic }
@@ -460,30 +457,27 @@ setImplicationStatus :: Implication -> TcS Implication
-- * Prune unnecessary evidence bindings
-- * Prune unnecessary child implications
-- Precondition: the ic_status field is not already IC_Solved
-setImplicationStatus implic@(Implic { ic_status = old_status
- , ic_info = info
- , ic_wanted = wc })
- = assertPpr (not (isSolvedStatus old_status)) (ppr info) $
- -- Precondition: we only set the status if it is not already solved
- do { traceTcS "setImplicationStatus {" (ppr implic)
-
- ; let solved = isSolvedWC wc
- ; new_implic <- neededEvVars implic
- ; bad_telescope <- if solved then checkBadTelescope implic
- else return False
-
- ; let new_status | insolubleWC wc = IC_Insoluble
- | not solved = IC_Unsolved
- | bad_telescope = IC_BadTelescope
- | otherwise = IC_Solved { ics_dead = dead_givens }
- dead_givens = findRedundantGivens new_implic
- new_wc = pruneImplications wc
-
- final_implic = new_implic { ic_status = new_status
- , ic_wanted = new_wc }
-
- ; traceTcS "setImplicationStatus }" (ppr final_implic)
- ; return final_implic }
+setImplicationStatus implic@(Implic { ic_wanted = wc })
+ | insolubleWC wc
+ = do { traceTcS "setImplicationStatus:insoluble" (ppr implic)
+ ; return (implic { ic_status = IC_Insoluble }) }
+
+ | not (isSolvedWC wc)
+ = -- Precondition: we only set the status if it is not /already/ solved
+ do { traceTcS "setImplicationStatus:in progress" (ppr implic)
+ ; return (implic { ic_status = IC_Unsolved }) }
+
+ | otherwise -- The Wanteds are all solved
+ = do { traceTcS "setImplicationStatus:solved" (ppr implic)
+ ; bad_telescope <- checkBadTelescope implic
+ ; if bad_telescope
+ then return (implic { ic_status = IC_BadTelescope })
+ else
+
+ do { solved_status <- computeSolvedStatus implic
+ ; let pruned_wc = pruneImplications wc
+ ; return (implic { ic_status = solved_status
+ , ic_wanted = pruned_wc }) } }
pruneImplications :: WantedConstraints -> WantedConstraints
-- We have now recorded the `ic_need` variables of the child
@@ -502,44 +496,6 @@ pruneImplications wc@(WC { wc_impl = implics })
| otherwise
= True -- Otherwise, keep it
-findRedundantGivens :: Implication -> [EvVar]
-findRedundantGivens (Implic { ic_info = info, ic_need = need, ic_given = givens })
- | not (warnRedundantGivens info) -- Don't report redundant constraints at all
- = [] -- See (TRC4) of Note [Tracking redundant constraints]
-
- | not (null unused_givens) -- Some givens are literally unused
- = unused_givens
-
- -- Only try this if unused_givens is empty: see (TRC2a)
- | otherwise -- All givens are used, but some might
- = redundant_givens -- still be redundant e.g. (Eq a, Ord a)
-
- where
- in_instance_decl = case info of { InstSkol {} -> True; _ -> False }
- -- See Note [Redundant constraints in instance decls]
-
- unused_givens = filterOut is_used givens
-
- needed_givens_ignoring_default_methods = ens_fvs need
- is_used given = is_type_error given
- || given `elemVarSet` needed_givens_ignoring_default_methods
- || (in_instance_decl && is_improving (idType given))
-
- minimal_givens = mkMinimalBySCs evVarPred givens -- See (TRC2)
-
- is_minimal = (`elemVarSet` mkVarSet minimal_givens)
- redundant_givens
- | in_instance_decl = []
- | otherwise = filterOut is_minimal givens
-
- -- See #15232
- is_type_error id = containsUserTypeError False (idType id)
- -- False <=> do not look under ty-fam apps, AppTy etc.
- -- See (UTE1) in Note [Custom type errors in constraints].
-
- is_improving pred -- (transSuperClasses p) does not include p
- = any isImprovementPred (pred : transSuperClasses pred)
-
warnRedundantGivens :: SkolemInfoAnon -> Bool
warnRedundantGivens (SigSkol ctxt _ _)
= case ctxt of
@@ -549,7 +505,7 @@ warnRedundantGivens (SigSkol ctxt _ _)
warnRedundantGivens (InstSkol from _)
-- Do not report redundant constraints for quantified constraints
- -- See (TRC4) in Note [Tracking redundant constraints]
+ -- See (TRC4) in Note [Tracking needed EvIds]
-- Fortunately it is easy to spot implications constraints that arise
-- from quantified constraints, from their SkolInfo
= case from of
@@ -611,113 +567,142 @@ checkBadTelescope (Implic { ic_info = info
| otherwise
= go (later_skols `extendVarSet` one_skol) earlier_skols
-neededEvVars :: Implication -> TcS Implication
--- Find all the evidence variables that are "needed",
--- /and/ delete dead evidence bindings
+computeSolvedStatus :: Implication -> TcS ImplicStatus
+-- Given a fully-solved implication,
+-- - Figure out the right IC_Solved fields
+-- - Delete unused evidence bindings
--
--- See Note [Tracking redundant constraints]
+-- See Note [Tracking needed EvIds]
-- See Note [Delete dead Given evidence bindings]
---
--- - Start from initial_seeds (from nested implications)
---
--- - Add free vars of RHS of all Wanted evidence bindings
--- and coercion variables accumulated in tcvs (all Wanted)
---
--- - Generate 'needed', the needed set of EvVars, by doing transitive
--- closure through Given bindings
--- e.g. Needed {a,b}
--- Given a = sc_sel a2
--- Then a2 is needed too
---
--- - Prune out all Given bindings that are not needed
-
-neededEvVars implic@(Implic { ic_info = info
+computeSolvedStatus (Implic { ic_info = info
, ic_binds = ev_binds_var
- , ic_wanted = WC { wc_impl = implics }
- , ic_need_implic = old_need_implic -- See (TRC1)
- })
- = do { ev_binds <- TcS.getTcEvBindsMap ev_binds_var
- ; used_cos <- TcS.getTcEvTyCoVars ev_binds_var
-
- ; let -- Find the variables needed by `implics`
- new_need_implic@(ENS { ens_dms = dm_seeds, ens_fvs = other_seeds })
- = foldr add_implic old_need_implic implics
- -- Start from old_need_implic! See (TRC1)
-
- -- Get the variables needed by the solved bindings
- -- (It's OK to use a non-deterministic fold here
- -- because add_wanted is commutative.)
- used_covars = coVarsOfCos used_cos
- seeds_w = nonDetStrictFoldEvBindMap add_wanted used_covars ev_binds
-
- need_ignoring_dms = findNeededGivenEvVars ev_binds (other_seeds `unionVarSet` seeds_w)
- need_from_dms = findNeededGivenEvVars ev_binds dm_seeds
- need_full = need_ignoring_dms `unionVarSet` need_from_dms
-
- -- `need`: the Givens from outer scopes that are used in this implication
- -- is_dm_skol: see (TRC5)
- need | is_dm_skol info = ENS { ens_dms = trim ev_binds need_full
- , ens_fvs = emptyVarSet }
- | otherwise = ENS { ens_dms = trim ev_binds need_from_dms
- , ens_fvs = trim ev_binds need_ignoring_dms }
-
- -- Delete dead Given evidence bindings
+ , ic_given = givens
+ , ic_wanted = WC { wc_impl = implics } })
+ = do { ev_binds_state <- TcS.getTcEvBindsState ev_binds_var
+
+ ; let EBS { ebs_binds = ev_binds, ebs_needs = local_needs } = ev_binds_state
+
+ -- Gather the raw needed EvIds, from the
+ -- current evidence bindings `local_needs`, and the `implics`
+ (need_dm, need_non_dm) = foldr add_implic (emptyVarSet, local_needs) implics
+
+ -- Do transitive closure through the evidence bindings
+ -- and delete all EvIds bound by the bindings
+ need_dm1 = findNeededGivenEvVars ev_binds need_dm
+ need_non_dm1 = findNeededGivenEvVars ev_binds need_non_dm
+
+ -- Compute the redundant Givens
+ dead_givens = findRedundantGivens info need_non_dm1 givens
+
+ -- Delete variables bound by ev_binds or by givens
+ need_dm2 = trim_needs need_dm1
+ need_non_dm2 = trim_needs need_non_dm1
+
+ trim_needs :: NeededEvIds -> NeededEvIds
+ trim_needs needs = (needs `varSetMinusEvBindsMap` ev_binds)
+ `delVarSetList` givens
+
+ -- Prune dead Given evidence bindings
-- See Note [Delete dead Given evidence bindings]
- ; let live_ev_binds = filterEvBindMap (needed_ev_bind need_full) ev_binds
- ; TcS.setTcEvBindsMap ev_binds_var live_ev_binds
-
- ; traceTcS "neededEvVars" $
- vcat [ text "old_need_implic:" <+> ppr old_need_implic
- , text "new_need_implic:" <+> ppr new_need_implic
- , text "used_covars:" <+> ppr used_covars
- , text "need_ignoring_dms:" <+> ppr need_ignoring_dms
- , text "need_from_dms:" <+> ppr need_from_dms
- , text "need:" <+> ppr need
+ ; let need_full = need_dm1 `unionVarSet` need_non_dm1
+ pruned_ev_binds = filterEvBindsMap (keep_ev_bind need_full) ev_binds
+ ; TcS.setTcEvBindsMap ev_binds_var pruned_ev_binds
+
+ ; traceTcS "computeSolvedStatus" $
+ vcat [ text "local_needs:" <+> ppr local_needs
+ , text "need_dm:" <+> ppr need_dm
+ , text "need_non_dm:" <+> ppr need_non_dm
+ , text "need_dm1:" <+> ppr need_dm1
+ , text "need_non_dm1:" <+> ppr need_non_dm1
+ , text "need_dm2:" <+> ppr need_dm2
+ , text "need_non_dm2:" <+> ppr need_non_dm2
, text "ev_binds:" <+> ppr ev_binds
- , text "live_ev_binds:" <+> ppr live_ev_binds ]
- ; return (implic { ic_need = need
- , ic_need_implic = new_need_implic }) }
- where
- trim :: EvBindMap -> VarSet -> VarSet
- -- Delete variables bound by Givens or bindings
- trim ev_binds needs = needs `varSetMinusEvBindMap` ev_binds
+ , text "deleted ev_binds:"
+ <+> ppr (filterEvBindsMap (not . keep_ev_bind need_full) ev_binds) ]
+
+ ; if is_dm_skol info
+ then return (IC_Solved { ics_dead = dead_givens
+ , ics_dm = need_dm2 `unionVarSet` need_non_dm2
+ , ics_non_dm = emptyVarSet })
- add_implic :: Implication -> EvNeedSet -> EvNeedSet
- add_implic (Implic { ic_given = givens, ic_need = need }) acc
- = (need `delGivensFromEvNeedSet` givens) `unionEvNeedSet` acc
+ else return (IC_Solved { ics_dead = dead_givens
+ , ics_dm = need_dm2
+ , ics_non_dm = need_non_dm2 }) }
+ where
+ add_implic :: Implication -> (NeededEvIds, NeededEvIds) -> (NeededEvIds, NeededEvIds)
+ add_implic (Implic { ic_status = status}) (dm2, non_dm2)
+ | IC_Solved { ics_dm = dm1, ics_non_dm = non_dm1 } <- status
+ = (dm1 `unionVarSet` dm2, non_dm1 `unionVarSet` non_dm2)
+ | otherwise
+ = pprPanic "computeSolvedStatus" (ppr implics)
- needed_ev_bind needed (EvBind { eb_lhs = ev_var, eb_info = info })
+ keep_ev_bind :: NeededEvIds -> EvBind -> Bool
+ -- False => we can discard this unused Given evidence binding
+ -- We always keep all the Wanted bindings
+ keep_ev_bind needed (EvBind { eb_lhs = ev_var, eb_info = info })
| EvBindGiven{} <- info = ev_var `elemVarSet` needed
| otherwise = True -- Keep all wanted bindings
- add_wanted :: EvBind -> VarSet -> VarSet
- add_wanted (EvBind { eb_info = info, eb_rhs = rhs }) needs
- | EvBindGiven{} <- info = needs -- Add the rhs vars of the Wanted bindings only
- | otherwise = nestedEvIdsOfTerm rhs `unionVarSet` needs
-
is_dm_skol :: SkolemInfoAnon -> Bool
is_dm_skol (MethSkol _ is_dm) = is_dm
is_dm_skol _ = False
-findNeededGivenEvVars :: EvBindMap -> VarSet -> VarSet
+findRedundantGivens :: SkolemInfoAnon -> NeededEvIds -> [EvVar] -> [EvVar]
+findRedundantGivens info need givens
+ | not (warnRedundantGivens info) -- Don't report redundant constraints at all
+ = [] -- See (TRC4) of Note [Tracking needed EvIds]
+
+ | not (null unused_givens) -- Some givens are literally unused
+ = unused_givens
+
+ -- Only try this if unused_givens is empty: see (TRC2a)
+ | otherwise -- All givens are used, but some might
+ = redundant_givens -- still be redundant e.g. (Eq a, Ord a)
+
+ where
+ in_instance_decl = case info of { InstSkol {} -> True; _ -> False }
+ -- See Note [Redundant constraints in instance decls]
+
+ unused_givens = filterOut is_used givens
+
+ is_used given = is_type_error given
+ || given `elemVarSet` need
+ || (in_instance_decl && is_improving (idType given))
+
+ minimal_givens = mkMinimalBySCs evVarPred givens -- See (TRC2)
+
+ is_minimal = (`elemVarSet` mkVarSet minimal_givens)
+ redundant_givens
+ | in_instance_decl = []
+ | otherwise = filterOut is_minimal givens
+
+ -- See #15232
+ is_type_error id = containsUserTypeError False (idType id)
+ -- False <=> do not look under ty-fam apps, AppTy etc.
+ -- See (UTE1) in Note [Custom type errors in constraints].
+
+ is_improving pred -- (transSuperClasses p) does not include p
+ = any isImprovementPred (pred : transSuperClasses pred)
+
+findNeededGivenEvVars :: EvBindsMap -> NeededEvIds -> NeededEvIds
-- Find all the Given evidence needed by seeds,
-- looking transitively through bindings for Givens (only)
findNeededGivenEvVars ev_binds seeds
= transCloVarSet also_needs seeds
where
- also_needs :: VarSet -> VarSet
- also_needs needs = nonDetStrictFoldUniqSet add emptyVarSet needs
- -- It's OK to use a non-deterministic fold here because we immediately
- -- forget about the ordering by creating a set
-
- add :: Var -> VarSet -> VarSet
- add v needs
- | Just ev_bind <- lookupEvBind ev_binds v
- , EvBind { eb_info = EvBindGiven, eb_rhs = rhs } <- ev_bind
- -- Look at Given bindings only
- = nestedEvIdsOfTerm rhs `unionVarSet` needs
- | otherwise
- = needs
+ also_needs :: VarSet -> VarSet
+ also_needs needs = nonDetStrictFoldUniqSet add emptyVarSet needs
+ -- It's OK to use a non-deterministic fold here because we immediately
+ -- forget about the ordering by creating a set
+
+ add :: Var -> VarSet -> VarSet
+ add v needs
+ | Just ev_bind <- lookupEvBind ev_binds v
+ , EvBind { eb_info = EvBindGiven, eb_rhs = rhs } <- ev_bind
+ -- Look at Given bindings only
+ = nestedEvIdsOfTerm rhs `unionVarSet` needs
+ | otherwise
+ = needs
-------------------------------------------------
simplifyDelayedErrors :: Bag DelayedError -> TcS (Bag DelayedError)
@@ -837,26 +822,80 @@ from TypeHole in HoleSort.
See also Note [Extra-constraint holes in partial type signatures]
in GHC.Tc.Gen.HsType.
-Note [Tracking redundant constraints]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-With Opt_WarnRedundantConstraints, GHC can report which constraints of a type
-signature (or instance declaration) are redundant, and can be omitted. Here is
-an overview of how it works.
+Note [Tracking needed EvIds]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The solver has some careful footwork to track:
+
+ Which Given EvIds are in fact needed
+
+The relevant type is NeededEvIds, which is just a VarSet; it may be a mixture
+of DictIds and CoVars.
+
+The NeededEvIds are used for two related purposes:
-This is all tested in typecheck/should_compile/T20602 (among others).
+* Redundant Givens. With Opt_WarnRedundantConstraints, GHC can report which
+ constraints of a type signature (or instance declaration) are redundant, and
+ can be omitted. We report this by computing which of the Implication's
+ `ic_givens` are not in the `NeededIds` for that Implication.
-How tracking works:
+ See `findRedundantGivens`
-* We maintain the `ic_need` field in an implication:
- ic_need: the set of Given evidence variables that are needed somewhere
- inside this implication; and are bound either by this implication
- or by an enclosing one.
+* Pruning useless evidence bindings. The solver creates lots of superclass
+ bindings, in the EvBinds of an Implication, just in case they are needed. So
+ we might get
+ \ (d::Ord a). let d2:Eq a = sc_sel d in ...
+ That `d2` binding may or may not be needed. For fully-solved implications,
+ GHC prunes away the un-needed bindings simply to reduce clutter; less to zonk,
+ less to desugar etc.
-* `setImplicationStatus` does all the work:
- - When the constraint solver finishes solving all the wanteds in
- an implication, it sets its status to IC_Solved
+ See Note [Delete dead Given evidence bindings]
+ and the pruning code in `computeSolvedStatus`
+
+The tracking works like this:
+
+* An `Implication` has `ic_binds :: EvBindVar`.
+
+* That EvBindsVar holds a mutable reference to an `EvBindsState`.
+
+* That `EvBindsState` is a pair of
+ * ebs_binds :: EvBindsMap The evidence bindings themselves
+ * ebs_needs :: NeededEvIds The free EvIds of the Wanted `ebs_binds`
+ NB: only the Wanted ones!
+
+ When we add a new binding to `ebs_binds` we also add to `ebs_needs` the free
+ EvIds of the RHS, iff the binding is Wanted. Why Wanted only? Each Wanted
+ binding solves a Wanted constraint, so we want them all. But Given bindings
+ are speculative; we work them out in `findNeededGivenEvVars`.
+
+ See `GHC.Tc.Utils.Monad.addTcEvBind` and `addTcCoBind`
+
+* When an implication is fully Solved, we give it an `ic_status` of IC_Solved,
+ in `setImplicationStatus`:
+ data ImplicStatus
+ = ...
+ | IC_Solved { ics_dead :: [EvVar]
+ , ics_dm :: NeededEvIds
+ , ics_non_dm :: NeededEvIds }
+ The `ics_dead` field records the `ic_given` EvVars that are unused.
+ The other two fields record the NeededEvIds bound by /enclosing/ Implications;
+ that is, the `ic_given` from /this/ implication have been removed.
+
+ Why two fields? See (TRC5) below.
+
+* `computeSolvedStatus` does all the work of computing these fields.
+
+ - It combines the NeededEvIds from the sub-implications, plus
+ those from the bindings.
+
+ - It uses a transitive closure algorithm across the Given bindings
+ so find the transitive needs. E.g. suppose the bindings are
+ [G] d2 = sc_sel d1
+ [G] d3 = sc_sel d2
+ [W] w1 = d3
+ The `ebs_needs` for these bindings will be {d3} (free var of the RHS
+ of the Wanted bindings). But needing d3 needs d2 and needing d2 needs
+ d1. Hence the transitive closure in `findNeededGivenEvVars`.
- - `neededEvVars`: computes which evidence variables are needed by an
implication in `setImplicationStatus`. A variable is needed if
a) It is in the ic_need field of this implication, computed in
@@ -884,15 +923,13 @@ How tracking works:
Wrinkles:
-(TRC1) `pruneImplications` drops any sub-implications of an Implication
- that are irrelevant for error reporting:
- - no unsolved wanteds
- - no sub-implications
- - no redundant givens to report
- But in doing so we must not lose track of the variables that those implications
- needed! So we track the ic_needs of all child implications in `ic_need_implics`.
- Crucially, this set includes things need by child implications that have been
- discarded by `pruneImplications`.
+(TRC1) In `setImplicationStatus`, for a fully-solved Implication, we take
+ the opportunity to discard any fully-solved child implications, using
+ `pruneImplications`. We can't drop /all/ fully-solved children; we can
+ drop a sub-implication only if:
+ - it has empty `ics_dead` (if not, keep the Implication so we can report the
+ redundant givens later
+ - it itself has no sub-implications (presumably with redundant givens)
(TRC2) A Given can be redundant because it is implied by other Givens
f :: (Eq a, Ord a) => blah -- Eq a unnecessary
@@ -914,6 +951,7 @@ Wrinkles:
the one from the user-written Eq a, not the superclass selection. This means
we report the Ord a as redundant with -Wredundant-constraints, not the Eq a.
Getting this wrong was #20602.
+ See Note [Replacement vs keeping] in GHC.Tc.Solver.InertSet
(TRC4) We don't compute redundant givens for *every* implication; only
for those which reply True to `warnRedundantGivens`:
@@ -949,7 +987,7 @@ Wrinkles:
and because of the degnerate instance for `Show (T a)`, we don't need the `Eq a`
constraint. But we don't want to report it as redundant!
-(TRC5) Consider this (#25992), where `op2` has a default method
+(TRC5) Default methods. Consider this (#25992), where `op2` has a default method
class C a where { op1, op2 :: a -> a
; op2 = op1 . op1 }
instance C a => C [a] where
@@ -960,17 +998,22 @@ Wrinkles:
$dmop2 = op1 . op1
$fCList :: forall a. C a => C [a]
- $fCList @a (d::C a) = MkC (\(x:a).x) ($dmop2 @a d)
+ $fCList @a (d::C a) = MkC (\(x:a).x)
+ ($dmop2 @[a] ($fCList @a d))
+
+ Notice that `d` gets passed (indirectly) to `$dmop`: it appears to be
+ "needed". But it's only /really/ needed if some /other/ method or
+ superclass (in this case `op1`) uses it.
- Notice that `d` gets passed to `$dmop`: it is "needed". But it's only
- /really/ needed if some /other/ method (in this case `op1`) uses it.
+ So, in IC_Solved rather than one set of NeededEvIds we have /two/:
+ ics_dm: needed /only/ by default-method calls
+ ics_non_dm: needed by something other than a default-method call
+ Then:
+ - For tracking redundant Givens we use only ics_non_dm
+ - For pruning evidence bindings we use the union of the two
- So, rather than one set of "needed Givens" we use `EvNeedSet` to track
- a /pair/ of sets:
- ens_dms: needed /only/ by default-method calls
- ens_fvs: needed by something other than a default-method call
It's a bit of a palaver, but not really difficult.
- All the logic is localised in `neededEvVars`.
+ All the logic is localised in `computeSolvedStatus`.
But NOTE that this only applies to /vanilla/ default methods.
For /generic/ default methods, like
@@ -979,26 +1022,26 @@ Wrinkles:
the (Eq a) constraint really is needed (e.g. class NFData and #25992).
Hence the `Bool` field of `MethSkol` indicates a /vanilla/ default method.
------ Examples
+----- Examples of reporting redundant Givens
f, g, h :: (Eq a, Ord a) => a -> Bool
f x = x == x
g x = x > x
h x = x == x && x > x
- All of f,g,h will discover that they have two [G] Eq a constraints: one as
- given and one extracted from the Ord a constraint. They will both discard
- the latter; see (TRC3).
+All of f,g,h will discover that they have two [G] Eq a constraints: one as
+given and one extracted from the Ord a constraint. They will both discard
+the latter; see (TRC3).
- The body of f uses the [G] Eq a, but not the [G] Ord a. It will report a
- redundant Ord a.
+* The body of f uses the [G] Eq a, but not the [G] Ord a. It will report a
+ redundant Ord a.
- The body of g uses the [G] Ord a, but not the [G] Eq a. It will report a
- redundant Eq a.
+* The body of g uses the [G] Ord a, but not the [G] Eq a. It will report a
+ redundant Eq a.
- The body of h uses both [G] Ord a and [G] Eq a; each is used in a solved
- Wanted evidence binding. But (TRC2) kicks in and discovers the Eq a
- is redundant.
+* The body of h uses both [G] Ord a and [G] Eq a; each is used in a solved
+ Wanted evidence binding. But (TRC2) kicks in and discovers the Eq a
+ is redundant.
----- Shortcomings
@@ -1010,10 +1053,10 @@ Shortcoming 1. Consider
k :: (Eq a, b ~ a) => a -> Bool
k x = x == x
-Currently (Nov 2021), j issues no warning, while k says that b ~ a
-is redundant. This is because j uses the a ~ b constraint to rewrite
-everything to be in terms of b, while k does none of that. This is
-ridiculous, but I (Richard E) don't see a good fix.
+Currently (Nov 2021), j issues no warning, while k says that b ~ a is
+redundant. This is because j uses the a ~ b constraint to rewrite everything to
+be in terms of b, while k does none of that. This is ridiculous, but I (Richard
+E) don't see a good fix.
Shortcoming 2. Removing a redundant constraint can cause clients to fail to
compile, by making the function more polymorphic. Consider (#16154)
@@ -1645,10 +1688,12 @@ solveWantedQCI mode ct@(CQuantCan (QCI { qci_ev = ev, qci_tvs = tvs
-- carrying a record of which evidence variables are used
-- See Note [Free vars of EvFun] in GHC.Tc.Types.Evidence
do { setWantedDict dest EvCanonical $
- EvFun { et_tvs = skol_tvs, et_given = given_ev_vars
+ EvFun { et_tvs = skol_tvs
+ , et_given = given_ev_vars
, et_binds = TcEvBinds ev_binds_var
- , et_body = wantedCtEvEvId wanted_ev }
+ , et_body = wantedCtEvEvId wanted_ev }
+ ; traceTcS "solveWantedQCI" (ppr imp')
; return (Right imp') }
}
=====================================
compiler/GHC/Tc/TyCl/Instance.hs
=====================================
@@ -1481,8 +1481,7 @@ Notice that
implication for the whole instance declaration, with the expected
skolems and givens. We need this to get the correct "redundant
constraint" warnings, gathering all the uses from all the methods
- and superclasses. See GHC.Tc.Solver Note [Tracking redundant
- constraints]
+ and superclasses. See GHC.Tc.SolverSolve Note [Tracking needed EvIds]
* The given constraints in the outer implication may generate
evidence, notably by superclass selection. Since the method and
@@ -1947,7 +1946,7 @@ tcMethods _skol_info dfun_id clas tyvars dfun_ev_vars inst_tys
mismatched_meths = bind_nms `minusList` cls_meth_nms
is_vanilla_dm :: DefMethSpec ty -> Bool
- -- See (TRC5) in Note [Tracking redundant constraints]
+ -- See (TRC5) in Note [Tracking needed EvIds]
-- in GHC.Tc.Solver.Solve
is_vanilla_dm VanillaDM = True
is_vanilla_dm (GenericDM {}) = False
@@ -2022,7 +2021,7 @@ Instead, we take the following approach:
------------------------
tcMethodBody :: Bool -- True <=> This is a vanilla default method
- -- See (TRC5) in Note [Tracking redundant constraints]
+ -- See (TRC5) in Note [Tracking needed EvIds]
-- in GHC.Tc.Solver.Solve
-> Class -> [TcTyVar] -> [EvVar] -> [TcType]
-> TcEvBinds -> Bool
=====================================
compiler/GHC/Tc/Types/Constraint.hs
=====================================
@@ -65,7 +65,6 @@ module GHC.Tc.Types.Constraint (
ImplicStatus(..), isInsolubleStatus, isSolvedStatus,
UserGiven, getGivensFromImplics,
HasGivenEqs(..), checkImplicationInvariants,
- EvNeedSet(..), emptyEvNeedSet, unionEvNeedSet, extendEvNeedSet, delGivensFromEvNeedSet,
-- CtLocEnv
CtLocEnv(..), setCtLocEnvLoc, setCtLocEnvLvl, getCtLocEnvLoc, getCtLocEnvLvl, ctLocEnvInGeneratedCode,
@@ -1055,6 +1054,13 @@ mkImplicWC :: Bag Implication -> WantedConstraints
mkImplicWC implic
= emptyWC { wc_impl = implic }
+-- | `isEmptyWC` sees if a `WantedConstraints` is truly empty, including
+-- having no implications.
+--
+-- It's possible that it might have /solved/ implications, which are left around
+-- just so we can report unreachable code. So:
+-- isEmptyWC implies isSolvedWC
+-- but not vice versa
isEmptyWC :: WantedConstraints -> Bool
isEmptyWC (WC { wc_simple = f, wc_impl = i, wc_errors = errors })
= isEmptyBag f && isEmptyBag i && isEmptyBag errors
@@ -1557,45 +1563,9 @@ data Implication
ic_binds :: EvBindsVar, -- Points to the place to fill in the
-- abstraction and bindings.
- -- The ic_need fields keep track of which Given evidence
- -- is used by this implication or its children
- -- See Note [Tracking redundant constraints]
- -- NB: these sets include stuff used by fully-solved nested implications
- -- that have since been discarded
- ic_need :: EvNeedSet, -- All needed Given evidence, from this implication
- -- or outer ones
- -- That is, /after/ deleting the binders of ic_binds,
- -- but /before/ deleting ic_givens
-
- ic_need_implic :: EvNeedSet, -- Union of of the ic_need of all implications in ic_wanted
- -- /including/ any fully-solved implications that have been
- -- discarded by `pruneImplications`. This discarding is why
- -- we need to keep this field in the first place.
-
ic_status :: ImplicStatus
}
-data EvNeedSet = ENS { ens_dms :: VarSet -- Needed only by default methods
- , ens_fvs :: VarSet -- Needed by things /other than/ default methods
- -- See (TRC5) in Note [Tracking redundant constraints]
- }
-
-emptyEvNeedSet :: EvNeedSet
-emptyEvNeedSet = ENS { ens_dms = emptyVarSet, ens_fvs = emptyVarSet }
-
-unionEvNeedSet :: EvNeedSet -> EvNeedSet -> EvNeedSet
-unionEvNeedSet (ENS { ens_dms = dm1, ens_fvs = fv1 })
- (ENS { ens_dms = dm2, ens_fvs = fv2 })
- = ENS { ens_dms = dm1 `unionVarSet` dm2, ens_fvs = fv1 `unionVarSet` fv2 }
-
-extendEvNeedSet :: EvNeedSet -> Var -> EvNeedSet
-extendEvNeedSet ens@(ENS { ens_fvs = fvs }) v = ens { ens_fvs = fvs `extendVarSet` v }
-
-delGivensFromEvNeedSet :: EvNeedSet -> [Var] -> EvNeedSet
-delGivensFromEvNeedSet (ENS { ens_dms = dms, ens_fvs = fvs }) givens
- = ENS { ens_dms = dms `delVarSetList` givens
- , ens_fvs = fvs `delVarSetList` givens }
-
implicationPrototype :: CtLocEnv -> Implication
implicationPrototype ct_loc_env
= Implic { -- These fields must be initialised
@@ -1612,14 +1582,21 @@ implicationPrototype ct_loc_env
, ic_given = []
, ic_wanted = emptyWC
, ic_given_eqs = MaybeGivenEqs
- , ic_status = IC_Unsolved
- , ic_need = emptyEvNeedSet
- , ic_need_implic = emptyEvNeedSet }
+ , ic_status = IC_Unsolved }
data ImplicStatus
= IC_Solved -- All wanteds in the tree are solved, all the way down
- { ics_dead :: [EvVar] } -- Subset of ic_given that are not needed
- -- See Note [Tracking redundant constraints] in GHC.Tc.Solver
+ { ics_dead :: [EvVar] -- Subset of ic_given that are not needed
+
+ , ics_dm :: NeededEvIds -- Enclosing Given EvIds that are needed by
+ -- calls to default methods (typically empty)
+
+ , ics_non_dm :: NeededEvIds -- Enclosing Given EvIds that are needed, other than
+ -- calls to default methods
+ }
+ -- Reporting redundant givens: use ics_non_dm
+ -- Pruning evidence bindings: use ics_dm `union` ics_non_dm
+ -- See Note [Tracking needed EvIds] in GHC.Tc.Solver.Solve
| IC_Insoluble -- At least one insoluble Wanted constraint in the tree
@@ -1708,7 +1685,6 @@ instance Outputable Implication where
, ic_given = given, ic_given_eqs = given_eqs
, ic_wanted = wanted, ic_status = status
, ic_binds = binds
- , ic_need = need, ic_need_implic = need_implic
, ic_info = info })
= hang (text "Implic" <+> lbrace)
2 (sep [ text "TcLevel =" <+> ppr tclvl
@@ -1718,21 +1694,17 @@ instance Outputable Implication where
, hang (text "Given =") 2 (pprEvVars given)
, hang (text "Wanted =") 2 (ppr wanted)
, text "Binds =" <+> ppr binds
- , text "need =" <+> ppr need
- , text "need_implic =" <+> ppr need_implic
, pprSkolInfo info ] <+> rbrace)
-instance Outputable EvNeedSet where
- ppr (ENS { ens_dms = dms, ens_fvs = fvs })
- = text "ENS" <> braces (sep [text "ens_dms =" <+> ppr dms
- , text "ens_fvs =" <+> ppr fvs])
-
instance Outputable ImplicStatus where
ppr IC_Insoluble = text "Insoluble"
ppr IC_BadTelescope = text "Bad telescope"
ppr IC_Unsolved = text "Unsolved"
- ppr (IC_Solved { ics_dead = dead })
- = text "Solved" <+> (braces (text "Dead givens =" <+> ppr dead))
+ ppr (IC_Solved { ics_dead = dead, ics_dm = dm, ics_non_dm = non_dm })
+ = text "Solved" <> (braces $
+ vcat [ text "Dead givens =" <+> ppr dead
+ , text "need_dm =" <+> ppr dm
+ , text "need_non_dm =" <+> ppr non_dm ])
checkTelescopeSkol :: SkolemInfoAnon -> Bool
-- See Note [Checking telescopes]
=====================================
compiler/GHC/Tc/Types/Evidence.hs
=====================================
@@ -14,14 +14,15 @@ module GHC.Tc.Types.Evidence (
optSubTypeHsWrapper,
-- * Evidence bindings
- TcEvBinds(..), EvBindsVar(..),
- EvBindMap(..), emptyEvBindMap, extendEvBinds, unionEvBindMap,
+ TcEvBinds(..), EvBindsVar(..), NeededEvIds,
+ EvBindsState(..), emptyEvBindsState, unionEvBindsState, addNeededEvIdsEBS,
+ EvBindsMap(..), emptyEvBindsMap, extendEvBinds, unionEvBindsMap,
lookupEvBind, evBindMapBinds,
- foldEvBindMap, nonDetStrictFoldEvBindMap,
- filterEvBindMap,
- isEmptyEvBindMap,
+ foldEvBindsMap, nonDetStrictFoldEvBindsMap,
+ filterEvBindsMap,
+ isEmptyEvBindsMap,
evBindMapToVarSet,
- varSetMinusEvBindMap,
+ varSetMinusEvBindsMap,
EvBindInfo(..), EvBind(..), emptyTcEvBinds, isEmptyTcEvBinds, mkGivenEvBind, mkWantedEvBind,
evBindVar, isCoEvBindsVar,
@@ -725,30 +726,45 @@ data EvBindsVar
ebv_uniq :: Unique,
-- The Unique is for debug printing only
- ebv_binds :: IORef EvBindMap,
+ ebv_binds :: IORef EvBindsState
-- The main payload: the value-level evidence bindings
-- (dictionaries etc)
- -- Some Given, some Wanted
-
- ebv_tcvs :: IORef [TcCoercion]
- -- When we solve a Wanted by filling in a CoercionHole, it is as
- -- if we were adding an evidence binding
- -- co_hole := coercion
- -- We keep all these RHS coercions in a list, alongside `ebv_binds`,
- -- so that we can report unused given constraints,
- -- in GHC.Tc.Solver.neededEvVars
- -- See Note [Tracking redundant constraints] in GHC.Tc.Solver
- -- Also: we garbage-collect unused bindings in `neededEvVars`,
- -- so this matters for correctness too.
+ -- Some Given, some Wanted; this is tracked in the `eb_info`
+ -- field of the `EvBind`.
}
| CoEvBindsVar { -- See Note [Coercion evidence only]
-- See above for comments on ebv_uniq, ebv_tcvs
- ebv_uniq :: Unique,
- ebv_tcvs :: IORef [TcCoercion]
+ ebv_uniq :: Unique,
+ ebv_needs :: IORef NeededEvIds
}
+type NeededEvIds = VarSet
+
+data EvBindsState = EBS { ebs_binds :: EvBindsMap
+ , ebs_needs :: NeededEvIds }
+
+emptyEvBindsState :: EvBindsState
+emptyEvBindsState = EBS { ebs_binds = emptyEvBindsMap
+ , ebs_needs = emptyVarSet }
+
+unionEvBindsState :: EvBindsState -> EvBindsState -> EvBindsState
+unionEvBindsState (EBS { ebs_binds = bs1, ebs_needs = n1 })
+ (EBS { ebs_binds = bs2, ebs_needs = n2 })
+ = EBS { ebs_binds = bs1 `unionEvBindsMap` bs2
+ , ebs_needs = n1 `unionVarSet` n2 }
+
+addNeededEvIdsEBS :: NeededEvIds -> EvBindsState -> EvBindsState
+addNeededEvIdsEBS n1 ebs@(EBS { ebs_needs = n2 })
+ = ebs { ebs_needs = n1 `unionVarSet` n2 }
+
+instance Outputable EvBindsState where
+ ppr (EBS { ebs_binds = bs, ebs_needs = needs })
+ = text "EBS" <> (braces $
+ sep [ text "needs =" <+> ppr needs
+ , text "binds =" <+> ppr bs ])
+
instance Data.Data TcEvBinds where
-- Placeholder; we can't traverse into TcEvBinds
toConstr _ = abstractConstr "TcEvBinds"
@@ -778,8 +794,8 @@ isCoEvBindsVar (CoEvBindsVar {}) = True
isCoEvBindsVar (EvBindsVar {}) = False
-----------------
-newtype EvBindMap
- = EvBindMap {
+newtype EvBindsMap
+ = EvBindsMap {
ev_bind_varenv :: DVarEnv EvBind
} -- Map from evidence variables to evidence terms
-- We use @DVarEnv@ here to get deterministic ordering when we
@@ -801,56 +817,56 @@ newtype EvBindMap
-- See Note [Deterministic UniqFM] in GHC.Types.Unique.DFM for explanation why
-- @UniqFM@ can lead to nondeterministic order.
-emptyEvBindMap :: EvBindMap
-emptyEvBindMap = EvBindMap { ev_bind_varenv = emptyDVarEnv }
+emptyEvBindsMap :: EvBindsMap
+emptyEvBindsMap = EvBindsMap { ev_bind_varenv = emptyDVarEnv }
-extendEvBinds :: EvBindMap -> EvBind -> EvBindMap
+extendEvBinds :: EvBindsMap -> EvBind -> EvBindsMap
extendEvBinds bs ev_bind
- = EvBindMap { ev_bind_varenv = extendDVarEnv (ev_bind_varenv bs)
+ = EvBindsMap { ev_bind_varenv = extendDVarEnv (ev_bind_varenv bs)
(eb_lhs ev_bind)
ev_bind }
-- | Union two evidence binding maps
-unionEvBindMap :: EvBindMap -> EvBindMap -> EvBindMap
-unionEvBindMap (EvBindMap env1) (EvBindMap env2) =
- EvBindMap { ev_bind_varenv = plusDVarEnv env1 env2 }
+unionEvBindsMap :: EvBindsMap -> EvBindsMap -> EvBindsMap
+unionEvBindsMap (EvBindsMap env1) (EvBindsMap env2) =
+ EvBindsMap { ev_bind_varenv = plusDVarEnv env1 env2 }
-isEmptyEvBindMap :: EvBindMap -> Bool
-isEmptyEvBindMap (EvBindMap m) = isEmptyDVarEnv m
+isEmptyEvBindsMap :: EvBindsMap -> Bool
+isEmptyEvBindsMap (EvBindsMap m) = isEmptyDVarEnv m
-lookupEvBind :: EvBindMap -> EvVar -> Maybe EvBind
+lookupEvBind :: EvBindsMap -> EvVar -> Maybe EvBind
lookupEvBind bs = lookupDVarEnv (ev_bind_varenv bs)
-evBindMapBinds :: EvBindMap -> Bag EvBind
-evBindMapBinds = foldEvBindMap consBag emptyBag
+evBindMapBinds :: EvBindsMap -> Bag EvBind
+evBindMapBinds = foldEvBindsMap consBag emptyBag
-foldEvBindMap :: (EvBind -> a -> a) -> a -> EvBindMap -> a
-foldEvBindMap k z bs = foldDVarEnv k z (ev_bind_varenv bs)
+foldEvBindsMap :: (EvBind -> a -> a) -> a -> EvBindsMap -> a
+foldEvBindsMap k z bs = foldDVarEnv k z (ev_bind_varenv bs)
-- See Note [Deterministic UniqFM] to learn about nondeterminism.
-- If you use this please provide a justification why it doesn't introduce
-- nondeterminism.
-nonDetStrictFoldEvBindMap :: (EvBind -> a -> a) -> a -> EvBindMap -> a
-nonDetStrictFoldEvBindMap k z bs = nonDetStrictFoldDVarEnv k z (ev_bind_varenv bs)
+nonDetStrictFoldEvBindsMap :: (EvBind -> a -> a) -> a -> EvBindsMap -> a
+nonDetStrictFoldEvBindsMap k z bs = nonDetStrictFoldDVarEnv k z (ev_bind_varenv bs)
-filterEvBindMap :: (EvBind -> Bool) -> EvBindMap -> EvBindMap
-filterEvBindMap k (EvBindMap { ev_bind_varenv = env })
- = EvBindMap { ev_bind_varenv = filterDVarEnv k env }
+filterEvBindsMap :: (EvBind -> Bool) -> EvBindsMap -> EvBindsMap
+filterEvBindsMap k (EvBindsMap { ev_bind_varenv = env })
+ = EvBindsMap { ev_bind_varenv = filterDVarEnv k env }
-evBindMapToVarSet :: EvBindMap -> VarSet
-evBindMapToVarSet (EvBindMap dve) = unsafeUFMToUniqSet (mapUFM evBindVar (udfmToUfm dve))
+evBindMapToVarSet :: EvBindsMap -> VarSet
+evBindMapToVarSet (EvBindsMap dve) = unsafeUFMToUniqSet (mapUFM evBindVar (udfmToUfm dve))
-varSetMinusEvBindMap :: VarSet -> EvBindMap -> VarSet
-varSetMinusEvBindMap vs (EvBindMap dve) = vs `uniqSetMinusUDFM` dve
+varSetMinusEvBindsMap :: VarSet -> EvBindsMap -> VarSet
+varSetMinusEvBindsMap vs (EvBindsMap dve) = vs `uniqSetMinusUDFM` dve
-instance Outputable EvBindMap where
- ppr (EvBindMap m) = ppr m
+instance Outputable EvBindsMap where
+ ppr (EvBindsMap m) = ppr m
-data EvBindInfo
- = EvBindGiven { -- See Note [Tracking redundant constraints] in GHC.Tc.Solver
- }
- | EvBindWanted { ebi_canonical :: CanonicalEvidence -- See Note [Desugaring non-canonical evidence]
- }
+data EvBindInfo -- See Note [Tracking needed EvIds] in GHC.Tc.Solver.Solve
+ = EvBindGiven
+ | EvBindWanted
+ { ebi_canonical :: CanonicalEvidence }
+ -- See Note [Desugaring non-canonical evidence]
-----------------
-- All evidence is bound by EvBinds; no side effects
@@ -1334,7 +1350,7 @@ can just squeeze by. Here's how.
* Each EvBindsVar in an et_binds field of an EvFun is /also/ in the
ic_binds field of an Implication
* So we can track usage via the processing for that implication,
- (see Note [Tracking redundant constraints] in GHC.Tc.Solver).
+ (see Note [Tracking needed EvIds] in GHC.Tc.Solver).
We can ignore usage from the EvFun altogether.
* /After/ typechecking `evTermFVs` is used by `GHC.Iface.Ext.Ast`, but by
=====================================
compiler/GHC/Tc/Types/Origin.hs
=====================================
@@ -94,7 +94,7 @@ data UserTypeCtxt
-- Also used for types in SPECIALISE pragmas
Name -- Name of the function
ReportRedundantConstraints
- -- See Note [Tracking redundant constraints] in GHC.Tc.Solver
+ -- See Note [Tracking needed EvIds] in GHC.Tc.Solver
-- This field is usually 'WantRCC', but 'NoRCC' for
-- * Record selectors (not important here)
-- * Class and instance methods. Here the code may legitimately
@@ -285,7 +285,7 @@ data SkolemInfoAnon
| MethSkol Name Bool -- Bound by the type of class method op
-- True <=> it's a vanilla default method
-- False <=> it's a user-written, or generic-default, method
- -- See (TRC5) in Note [Tracking redundant constraints]
+ -- See (TRC5) in Note [Tracking needed EvIds]
-- in GHC.Tc.Solver.Solve
| FamInstSkol -- Bound at a family instance decl
=====================================
compiler/GHC/Tc/Utils/Monad.hs
=====================================
@@ -104,9 +104,10 @@ module GHC.Tc.Utils.Monad(
-- * Type constraints
newTcEvBinds, newNoTcEvBinds, cloneEvBindsVar,
- addTcEvBind, addTcEvBinds, addTopEvBinds,
- getTcEvBindsMap, setTcEvBindsMap, updTcEvBinds,
- getTcEvTyCoVars, chooseUniqueOccTc,
+ addTcEvCoBind, addTcEvBind, addTopEvBinds,
+ getTcEvBindsMap, getTcEvBindsState,
+ setTcEvBindsMap, combineTcEvBinds, addNeededEvIds,
+ chooseUniqueOccTc,
getConstraintVar, setConstraintVar,
emitConstraints, emitSimple, emitSimples,
emitImplication, emitImplications, ensureReflMultiplicityCo,
@@ -118,6 +119,7 @@ module GHC.Tc.Utils.Monad(
getLclTypeEnv, setLclTypeEnv,
traceTcConstraints,
emitNamedTypeHole, IsExtraConstraint(..), emitAnonTypeHole,
+ fillCoercionHole,
-- * Template Haskell context
recordThUse, recordThNeededRuntimeDeps,
@@ -187,12 +189,13 @@ import GHC.Unit.Module.Warnings
import GHC.Unit.Home.PackageTable
import GHC.Core.UsageEnv
-
import GHC.Core.Coercion ( isReflCo )
import GHC.Core.Multiplicity
import GHC.Core.InstEnv
import GHC.Core.FamInstEnv
import GHC.Core.Type( mkNumLitTy )
+import GHC.Core.TyCo.Rep( CoercionHole(..) )
+import GHC.Core.TyCo.FVs( coVarsOfCo )
import GHC.Core.TyCon ( TyCon )
import GHC.Driver.Env
@@ -230,6 +233,7 @@ import GHC.Types.SafeHaskell
import GHC.Types.Id
import GHC.Types.TypeEnv
import GHC.Types.Var.Env
+import GHC.Types.Var.Set
import GHC.Types.SrcLoc
import GHC.Types.Name.Env
import GHC.Types.Name.Set
@@ -1660,6 +1664,105 @@ tryTcDiscardingErrs' validate recover_invalid recover_error thing_inside
recover_error
}
+{- Note [Constraints and errors]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Consider this (#12124):
+
+ foo :: Maybe Int
+ foo = return (case Left 3 of
+ Left -> 1 -- Hard error here!
+ _ -> 0)
+
+The call to 'return' will generate a (Monad m) wanted constraint; but
+then there'll be "hard error" (i.e. an exception in the TcM monad), from
+the unsaturated Left constructor pattern.
+
+We'll recover in tcPolyBinds, using recoverM. But then the final
+tcSimplifyTop will see that (Monad m) constraint, with 'm' utterly
+un-filled-in, and will emit a misleading error message.
+
+The underlying problem is that an exception interrupts the constraint
+gathering process. Bottom line: if we have an exception, it's best
+simply to discard any gathered constraints. Hence in 'attemptM' we
+capture the constraints in a fresh variable, and only emit them into
+the surrounding context if we exit normally. If an exception is
+raised, simply discard the collected constraints... we have a hard
+error to report. So this capture-the-emit dance isn't as stupid as it
+looks :-).
+
+However suppose we throw an exception inside an invocation of
+captureConstraints, and discard all the constraints. Some of those
+constraints might be "variable out of scope" Hole constraints, and that
+might have been the actual original cause of the exception! For
+example (#12529):
+ f = p @ Int
+Here 'p' is out of scope, so we get an insoluble Hole constraint. But
+the visible type application fails in the monad (throws an exception).
+We must not discard the out-of-scope error.
+
+It's distressingly delicate though:
+
+* If we discard too /many/ constraints we may fail to report the error
+ that led us to interrupt the constraint gathering process.
+
+ One particular example "variable out of scope" Hole constraints. For
+ example (#12529):
+ f = p @ Int
+ Here 'p' is out of scope, so we get an insoluble Hole constraint. But
+ the visible type application fails in the monad (throws an exception).
+ We must not discard the out-of-scope error.
+
+ Also GHC.Tc.Solver.simplifyAndEmitFlatConstraints may fail having
+ emitted some constraints with skolem-escape problems.
+
+* If we discard too /few/ constraints, we may get the misleading
+ class constraints mentioned above.
+
+ We may /also/ end up taking constraints built at some inner level, and
+ emitting them (via the exception catching in `tryCaptureConstraints`) at some
+ outer level, and then breaking the TcLevel invariants See Note [TcLevel
+ invariants] in GHC.Tc.Utils.TcType
+
+So `dropMisleading` has a horridly ad-hoc structure:
+
+* It keeps only /insoluble/ flat constraints (which are unlikely to very visibly
+ trip up on the TcLevel invariant)
+
+* But it keeps all /implication/ constraints (except the class constraints
+ inside them). The implication constraints are OK because they set the ambient
+ level before attempting to solve any inner constraints.
+
+Ugh! I hate this. But it seems to work.
+
+Other wrinkles
+
+(CERR1) Note that freshly-generated constraints like (Int ~ Bool), or
+ ((a -> b) ~ Int) are all CNonCanonical, and hence won't be flagged as
+ insoluble. The constraint solver does that. So they'll be discarded.
+ That's probably ok; but see th/5358 as a not-so-good example:
+ t1 :: Int
+ t1 x = x -- Manifestly wrong
+
+ foo = $(...raises exception...)
+ We report the exception, but not the bug in t1. Oh well. Possible
+ solution: make GHC.Tc.Utils.Unify.uType spot manifestly-insoluble constraints.
+
+(CERR2) In #26015 I found that from the constraints
+ [W] alpha ~ Int -- A class constraint
+ [W] F alpha ~# Bool -- An equality constraint
+ we were dropping the first (because it's a class constraint) but not the
+ second, and then getting a misleading error message from the second. As
+ #25607 shows, we can get not just one but a zillion bogus messages, which
+ conceal the one genuine error. Boo.
+
+ For now I have added an even more ad-hoc "drop class constraints except
+ equality classes (~) and (~~)"; see `dropMisleading`. That just kicks the can
+ down the road; but this problem seems somewhat rare anyway. The code in
+ `dropMisleading` hasn't changed for years.
+
+It would be great to have a more systematic solution to this entire mess.
+-}
+
{-
************************************************************************
* *
@@ -1854,108 +1957,113 @@ debugTc thing
addTopEvBinds :: Bag EvBind -> TcM a -> TcM a
addTopEvBinds new_ev_binds thing_inside
- =updGblEnv upd_env thing_inside
+ = updGblEnv upd_env thing_inside
where
upd_env tcg_env = tcg_env { tcg_ev_binds = tcg_ev_binds tcg_env
`unionBags` new_ev_binds }
newTcEvBinds :: TcM EvBindsVar
-newTcEvBinds = do { binds_ref <- newTcRef emptyEvBindMap
- ; tcvs_ref <- newTcRef []
+newTcEvBinds = do { binds_ref <- newTcRef emptyEvBindsState
; uniq <- newUnique
; traceTc "newTcEvBinds" (text "unique =" <+> ppr uniq)
; return (EvBindsVar { ebv_binds = binds_ref
- , ebv_tcvs = tcvs_ref
, ebv_uniq = uniq }) }
-- | Creates an EvBindsVar incapable of holding any bindings. It still
--- tracks covar usages (see comments on ebv_tcvs in "GHC.Tc.Types.Evidence"), thus
+-- tracks covar usages (see comments on ebv_needs in "GHC.Tc.Types.Evidence"), thus
-- must be made monadically
newNoTcEvBinds :: TcM EvBindsVar
newNoTcEvBinds
- = do { tcvs_ref <- newTcRef []
+ = do { tcvs_ref <- newTcRef emptyVarSet
; uniq <- newUnique
; traceTc "newNoTcEvBinds" (text "unique =" <+> ppr uniq)
- ; return (CoEvBindsVar { ebv_tcvs = tcvs_ref
- , ebv_uniq = uniq }) }
+ ; return (CoEvBindsVar { ebv_needs = tcvs_ref
+ , ebv_uniq = uniq }) }
cloneEvBindsVar :: EvBindsVar -> TcM EvBindsVar
-- Clone the refs, so that any binding created when
-- solving don't pollute the original
cloneEvBindsVar ebv@(EvBindsVar {})
- = do { binds_ref <- newTcRef emptyEvBindMap
- ; tcvs_ref <- newTcRef []
- ; return (ebv { ebv_binds = binds_ref
- , ebv_tcvs = tcvs_ref }) }
+ = do { binds_ref <- newTcRef emptyEvBindsState
+ ; uniq <- newUnique
+ ; return (ebv { ebv_uniq = uniq
+ , ebv_binds = binds_ref }) }
cloneEvBindsVar ebv@(CoEvBindsVar {})
- = do { tcvs_ref <- newTcRef []
- ; return (ebv { ebv_tcvs = tcvs_ref }) }
+ = do { tcvs_ref <- newTcRef emptyVarSet
+ ; return (ebv { ebv_needs = tcvs_ref }) }
-getTcEvTyCoVars :: EvBindsVar -> TcM [TcCoercion]
-getTcEvTyCoVars ev_binds_var
- = readTcRef (ebv_tcvs ev_binds_var)
+getTcEvBindsMap :: EvBindsVar -> TcM EvBindsMap
+getTcEvBindsMap ebv = do { EBS { ebs_binds = bs } <- getTcEvBindsState ebv
+ ; return bs }
-getTcEvBindsMap :: EvBindsVar -> TcM EvBindMap
-getTcEvBindsMap (EvBindsVar { ebv_binds = ev_ref })
+getTcEvBindsState :: EvBindsVar -> TcM EvBindsState
+getTcEvBindsState (EvBindsVar { ebv_binds = ev_ref })
= readTcRef ev_ref
-getTcEvBindsMap (CoEvBindsVar {})
- = return emptyEvBindMap
-
-setTcEvBindsMap :: EvBindsVar -> EvBindMap -> TcM ()
-setTcEvBindsMap (EvBindsVar { ebv_binds = ev_ref }) binds
- = writeTcRef ev_ref binds
-setTcEvBindsMap v@(CoEvBindsVar {}) ev_binds
- | isEmptyEvBindMap ev_binds
- = return ()
- | otherwise
- = pprPanic "setTcEvBindsMap" (ppr v $$ ppr ev_binds)
-
-updTcEvBinds :: EvBindsVar -> EvBindsVar -> TcM ()
-updTcEvBinds (EvBindsVar { ebv_binds = old_ebv_ref, ebv_tcvs = old_tcv_ref })
- (EvBindsVar { ebv_binds = new_ebv_ref, ebv_tcvs = new_tcv_ref })
+getTcEvBindsState (CoEvBindsVar { ebv_needs = needs_ref })
+ = do { needs <- readTcRef needs_ref
+ ; return (EBS { ebs_binds = emptyEvBindsMap, ebs_needs = needs }) }
+
+setTcEvBindsMap :: EvBindsVar -> EvBindsMap -> TcM ()
+setTcEvBindsMap (EvBindsVar { ebv_binds = ev_ref }) ev_binds
+ = updTcRef ev_ref (\ebs -> ebs { ebs_binds = ev_binds })
+setTcEvBindsMap (CoEvBindsVar {}) ev_binds
+ = assertPpr (isEmptyEvBindsMap ev_binds) (ppr ev_binds) $
+ return ()
+
+combineTcEvBinds :: EvBindsVar -> EvBindsVar -> TcM ()
+combineTcEvBinds (EvBindsVar { ebv_binds = old_ebv_ref })
+ (EvBindsVar { ebv_binds = new_ebv_ref })
= do { new_ebvs <- readTcRef new_ebv_ref
- ; updTcRef old_ebv_ref (`unionEvBindMap` new_ebvs)
- ; new_tcvs <- readTcRef new_tcv_ref
- ; updTcRef old_tcv_ref (new_tcvs ++) }
-updTcEvBinds (EvBindsVar { ebv_tcvs = old_tcv_ref })
- (CoEvBindsVar { ebv_tcvs = new_tcv_ref })
+ ; updTcRef old_ebv_ref (`unionEvBindsState` new_ebvs) }
+combineTcEvBinds (EvBindsVar { ebv_binds = old_tcv_ref })
+ (CoEvBindsVar { ebv_needs = new_tcv_ref })
= do { new_tcvs <- readTcRef new_tcv_ref
- ; updTcRef old_tcv_ref (new_tcvs ++) }
-updTcEvBinds (CoEvBindsVar { ebv_tcvs = old_tcv_ref })
- (CoEvBindsVar { ebv_tcvs = new_tcv_ref })
+ ; updTcRef old_tcv_ref (addNeededEvIdsEBS new_tcvs) }
+combineTcEvBinds (CoEvBindsVar { ebv_needs = old_tcv_ref })
+ (CoEvBindsVar { ebv_needs = new_tcv_ref })
= do { new_tcvs <- readTcRef new_tcv_ref
- ; updTcRef old_tcv_ref (new_tcvs ++) }
-updTcEvBinds old_var new_var
- = pprPanic "updTcEvBinds" (ppr old_var $$ ppr new_var)
+ ; updTcRef old_tcv_ref (unionVarSet new_tcvs) }
+combineTcEvBinds old_var new_var
+ = pprPanic "combineTcEvBinds" (ppr old_var $$ ppr new_var)
-- Terms inside types, no good
+addNeededEvIds :: EvBindsVar -> NeededEvIds -> TcM ()
+addNeededEvIds (EvBindsVar { ebv_binds = bs_ref }) needed
+ = updTcRef bs_ref (addNeededEvIdsEBS needed)
+addNeededEvIds (CoEvBindsVar { ebv_needs = need_ref }) needed
+ = updTcRef need_ref (unionVarSet needed)
+
+addTcEvCoBind :: EvBindsVar -> CoercionHole -> CoercionPlusHoles -> TcM ()
+addTcEvCoBind ebv hole co_plus_holes@(CPH { cph_co = co })
+ = do { fillCoercionHole hole co_plus_holes
+ -- Record usage of the free vars of this coercion
+ ; addNeededEvIds ebv (coVarsOfCo co) }
+
addTcEvBind :: EvBindsVar -> EvBind -> TcM ()
-- Add a binding to the TcEvBinds by side effect
-addTcEvBind (EvBindsVar { ebv_binds = ev_ref, ebv_uniq = u }) ev_bind
- = do { bnds <- readTcRef ev_ref
- ; let bnds' = extendEvBinds bnds ev_bind
+addTcEvBind (EvBindsVar { ebv_binds = ev_ref, ebv_uniq = u })
+ ev_bind@(EvBind { eb_info = info, eb_rhs = rhs })
+ = do { EBS { ebs_binds = bnds, ebs_needs = needs } <- readTcRef ev_ref
+ ; let bnds' = extendEvBinds bnds ev_bind
+ needs' = case info of
+ EvBindWanted {} -> nestedEvIdsOfTerm rhs
+ `unionVarSet` needs
+ EvBindGiven {} -> needs
+
; traceTc "addTcEvBind" $
vcat [ text "EvBindsVar:" <+> ppr u
, text "ev_bind:" <+> ppr ev_bind
, text "bnds:" <+> ppr bnds
- , text "bnds':" <+> ppr bnds' ]
- ; writeTcRef ev_ref bnds' }
+ , text "bnds':" <+> ppr bnds'
+ , text "needs" <+> ppr needs
+ , text "needs'" <+> ppr needs' ]
+
+ ; writeTcRef ev_ref $
+ EBS { ebs_binds = bnds', ebs_needs = needs' } }
+
addTcEvBind (CoEvBindsVar { ebv_uniq = u }) ev_bind
= pprPanic "addTcEvBind CoEvBindsVar" (ppr ev_bind $$ ppr u)
-addTcEvBinds :: EvBindsVar -> EvBindMap -> TcM ()
--- ^ Add a collection of binding to the TcEvBinds by side effect
-addTcEvBinds _ new_ev_binds
- | isEmptyEvBindMap new_ev_binds
- = return ()
-addTcEvBinds (EvBindsVar { ebv_binds = ev_ref, ebv_uniq = u }) new_ev_binds
- = do { traceTc "addTcEvBinds" $ ppr u $$
- ppr new_ev_binds
- ; old_bnds <- readTcRef ev_ref
- ; writeTcRef ev_ref (old_bnds `unionEvBindMap` new_ev_binds) }
-addTcEvBinds (CoEvBindsVar { ebv_uniq = u }) new_ev_binds
- = pprPanic "addTcEvBinds CoEvBindsVar" (ppr new_ev_binds $$ ppr u)
-
chooseUniqueOccTc :: (OccSet -> OccName) -> TcM OccName
chooseUniqueOccTc fn =
do { env <- getGblEnv
@@ -2137,111 +2245,22 @@ emitNamedTypeHole (name, tv)
where
occ = nameOccName name
-{- Note [Constraints and errors]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Consider this (#12124):
-
- foo :: Maybe Int
- foo = return (case Left 3 of
- Left -> 1 -- Hard error here!
- _ -> 0)
-
-The call to 'return' will generate a (Monad m) wanted constraint; but
-then there'll be "hard error" (i.e. an exception in the TcM monad), from
-the unsaturated Left constructor pattern.
-
-We'll recover in tcPolyBinds, using recoverM. But then the final
-tcSimplifyTop will see that (Monad m) constraint, with 'm' utterly
-un-filled-in, and will emit a misleading error message.
-
-The underlying problem is that an exception interrupts the constraint
-gathering process. Bottom line: if we have an exception, it's best
-simply to discard any gathered constraints. Hence in 'attemptM' we
-capture the constraints in a fresh variable, and only emit them into
-the surrounding context if we exit normally. If an exception is
-raised, simply discard the collected constraints... we have a hard
-error to report. So this capture-the-emit dance isn't as stupid as it
-looks :-).
-
-However suppose we throw an exception inside an invocation of
-captureConstraints, and discard all the constraints. Some of those
-constraints might be "variable out of scope" Hole constraints, and that
-might have been the actual original cause of the exception! For
-example (#12529):
- f = p @ Int
-Here 'p' is out of scope, so we get an insoluble Hole constraint. But
-the visible type application fails in the monad (throws an exception).
-We must not discard the out-of-scope error.
-
-It's distressingly delicate though:
+-- | Put a value in a coercion hole
+fillCoercionHole :: CoercionHole -> CoercionPlusHoles -> TcM ()
+fillCoercionHole (CH { ch_ref = ref, ch_co_var = cv }) co
+ = do { when debugIsOn $
+ do { cts <- readTcRef ref
+ ; whenIsJust cts $ \old_co ->
+ pprPanic "Filling a filled coercion hole" (ppr cv $$ ppr co $$ ppr old_co) }
+ ; traceTc "Filling coercion hole" (ppr cv <+> text ":=" <+> ppr co)
+ ; writeTcRef ref (Just co) }
-* If we discard too /many/ constraints we may fail to report the error
- that led us to interrupt the constraint gathering process.
- One particular example "variable out of scope" Hole constraints. For
- example (#12529):
- f = p @ Int
- Here 'p' is out of scope, so we get an insoluble Hole constraint. But
- the visible type application fails in the monad (throws an exception).
- We must not discard the out-of-scope error.
-
- Also GHC.Tc.Solver.simplifyAndEmitFlatConstraints may fail having
- emitted some constraints with skolem-escape problems.
-
-* If we discard too /few/ constraints, we may get the misleading
- class constraints mentioned above.
-
- We may /also/ end up taking constraints built at some inner level, and
- emitting them (via the exception catching in `tryCaptureConstraints` at some
- outer level, and then breaking the TcLevel invariants See Note [TcLevel
- invariants] in GHC.Tc.Utils.TcType
-
-So `dropMisleading` has a horridly ad-hoc structure:
-
-* It keeps only /insoluble/ flat constraints (which are unlikely to very visibly
- trip up on the TcLevel invariant
-
-* But it keeps all /implication/ constraints (except the class constraints
- inside them). The implication constraints are OK because they set the ambient
- level before attempting to solve any inner constraints.
-
-Ugh! I hate this. But it seems to work.
-
-Other wrinkles
-
-(CERR1) Note that freshly-generated constraints like (Int ~ Bool), or
- ((a -> b) ~ Int) are all CNonCanonical, and hence won't be flagged as
- insoluble. The constraint solver does that. So they'll be discarded.
- That's probably ok; but see th/5358 as a not-so-good example:
- t1 :: Int
- t1 x = x -- Manifestly wrong
-
- foo = $(...raises exception...)
- We report the exception, but not the bug in t1. Oh well. Possible
- solution: make GHC.Tc.Utils.Unify.uType spot manifestly-insoluble constraints.
-
-(CERR2) In #26015 I found that from the constraints
- [W] alpha ~ Int -- A class constraint
- [W] F alpha ~# Bool -- An equality constraint
- we were dropping the first (becuase it's a class constraint) but not the
- second, and then getting a misleading error message from the second. As
- #25607 shows, we can get not just one but a zillion bogus messages, which
- conceal the one genuine error. Boo.
-
- For now I have added an even more ad-hoc "drop class constraints except
- equality classes (~) and (~~)"; see `dropMisleading`. That just kicks the can
- down the road; but this problem seems somewhat rare anyway. The code in
- `dropMisleading` hasn't changed for years.
-
-It would be great to have a more systematic solution to this entire mess.
-
-
-************************************************************************
+{- *********************************************************************
* *
Template Haskell context
* *
-************************************************************************
--}
+********************************************************************* -}
recordThUse :: TcM ()
recordThUse = do { env <- getGblEnv; writeTcRef (tcg_th_used env) True }
=====================================
compiler/GHC/Tc/Utils/TcMType.hs
=====================================
@@ -341,31 +341,13 @@ newImplication
(implicationPrototype (mkCtLocEnv env))
{ ic_warn_inaccessible = warn_inaccessible && not in_gen_code }
-{-
-************************************************************************
-* *
- Coercion holes
-* *
-************************************************************************
--}
-
newCoercionHole :: TcPredType -> TcM CoercionHole
-- For the Bool, see (EIK2) in Note [Equalities with heterogeneous kinds]
newCoercionHole pred_ty
= do { co_var <- newEvVar pred_ty
; traceTc "New coercion hole:" (ppr co_var <+> dcolon <+> ppr pred_ty)
; ref <- newMutVar Nothing
- ; return $ CoercionHole { ch_co_var = co_var, ch_ref = ref } }
-
--- | Put a value in a coercion hole
-fillCoercionHole :: CoercionHole -> CoercionPlusHoles -> TcM ()
-fillCoercionHole (CoercionHole { ch_ref = ref, ch_co_var = cv }) co
- = do { when debugIsOn $
- do { cts <- readTcRef ref
- ; whenIsJust cts $ \old_co ->
- pprPanic "Filling a filled coercion hole" (ppr cv $$ ppr co $$ ppr old_co) }
- ; traceTc "Filling coercion hole" (ppr cv <+> text ":=" <+> ppr co)
- ; writeTcRef ref (Just co) }
+ ; return $ CH { ch_co_var = co_var, ch_ref = ref } }
{- **********************************************************************
*
=====================================
compiler/GHC/Tc/Utils/Unify.hs
=====================================
@@ -418,7 +418,8 @@ Some examples:
-}
tcSkolemiseGeneral
- :: DeepSubsumptionFlag
+ :: HasDebugCallStack
+ => DeepSubsumptionFlag
-> UserTypeCtxt
-> TcType -> TcType -- top_ty and expected_ty
-- Here, top_ty is the type we started to skolemise; used only in SigSkol
@@ -446,15 +447,16 @@ tcSkolemiseGeneral ds_flag ctxt top_ty expected_ty thing_inside
; skol_info <- mkSkolemInfo sig_skol }
; let skol_tvs = map (binderVar . snd) tv_prs
- ; traceTc "tcSkolemiseGeneral" (pprUserTypeCtxt ctxt <+> ppr skol_tvs <+> ppr given)
+ ; traceTc "tcSkolemiseGeneral {" (pprUserTypeCtxt ctxt <+> ppr skol_tvs <+> ppr given)
; (ev_binds, result) <- checkConstraints sig_skol skol_tvs given $
thing_inside tv_prs rho_ty
+ ; traceTc "tcSkolemiseGeneral }" (ppr ev_binds $$ traceCallStackDoc)
; return (wrap <.> mkWpLet ev_binds, result) }
-- The ev_binds returned by checkConstraints is very
-- often empty, in which case mkWpLet is a no-op
-tcSkolemiseCompleteSig :: TcCompleteSig
+tcSkolemiseCompleteSig :: HasDebugCallStack => TcCompleteSig
-> ([ExpPatType] -> TcRhoType -> TcM result)
-> TcM (HsWrapper, result)
-- ^ The wrapper has type: spec_ty ~~> expected_ty
@@ -471,7 +473,7 @@ tcSkolemiseCompleteSig (CSig { sig_bndr = poly_id, sig_ctxt = ctxt, sig_loc = lo
tcExtendNameTyVarEnv (map (fmap binderVar) tv_prs) $
thing_inside (map (mkInvisExpPatType . snd) tv_prs) rho_ty }
-tcSkolemiseExpectedType :: TcSigmaType
+tcSkolemiseExpectedType :: HasDebugCallStack => TcSigmaType
-> ([ExpPatType] -> TcRhoType -> TcM result)
-> TcM (HsWrapper, result)
-- Just like tcSkolemiseCompleteSig, except that we don't have a user-written
@@ -483,14 +485,15 @@ tcSkolemiseExpectedType exp_ty thing_inside
= tcSkolemiseGeneral Shallow GenSigCtxt exp_ty exp_ty $ \tv_prs rho_ty ->
thing_inside (map (mkInvisExpPatType . snd) tv_prs) rho_ty
-tcSkolemise :: DeepSubsumptionFlag -> UserTypeCtxt -> TcSigmaType
+tcSkolemise :: HasDebugCallStack => DeepSubsumptionFlag -> UserTypeCtxt -> TcSigmaType
-> (TcRhoType -> TcM result)
-> TcM (HsWrapper, result)
tcSkolemise ds_flag ctxt expected_ty thing_inside
= tcSkolemiseGeneral ds_flag ctxt expected_ty expected_ty $ \_ rho_ty ->
thing_inside rho_ty
-checkConstraints :: SkolemInfoAnon
+checkConstraints :: HasDebugCallStack
+ => SkolemInfoAnon
-> [TcTyVar] -- Skolems
-> [EvVar] -- Given
-> TcM result
@@ -504,14 +507,16 @@ checkConstraints skol_info skol_tvs given thing_inside
; if implication_needed
then do { (tclvl, wanted, result) <- pushLevelAndCaptureConstraints thing_inside
; (implics, ev_binds) <- buildImplicationFor tclvl skol_info skol_tvs given wanted
- ; traceTc "checkConstraints" (ppr tclvl $$ ppr skol_tvs)
+ ; traceTc "checkConstraints A" (ppr tclvl $$ ppr skol_tvs $$ traceCallStackDoc)
; emitImplications implics
; return (ev_binds, result) }
else -- Fast path. We check every function argument with tcCheckPolyExpr,
-- which uses tcTopSkolemise and hence checkConstraints.
-- So this fast path is well-exercised
- do { res <- thing_inside
+ do { traceTc "checkConstraints B" (ppr skol_tvs $$ ppr given $$ ppr skol_info $$
+ traceCallStackDoc)
+ ; res <- thing_inside
; return (emptyTcEvBinds, res) } }
checkTvConstraints :: SkolemInfo
=====================================
compiler/GHC/Tc/Zonk/TcType.hs
=====================================
@@ -236,7 +236,7 @@ zonkCo :: Coercion -> ZonkM Coercion
, tcm_tycon = zonkTcTyCon }
where
hole :: () -> CoercionHole -> ZonkM Coercion
- hole _ hole@(CoercionHole { ch_ref = ref, ch_co_var = cv })
+ hole _ hole@(CH { ch_ref = ref, ch_co_var = cv })
= do { contents <- readTcRef ref
; case contents of
Just (CPH { cph_co = co })
@@ -617,7 +617,7 @@ instance Monoid UnfilledCoercionHoleMonoid where
-- | Is a coercion hole filled in?
isFilledCoercionHole :: CoercionHole -> ZonkM Bool
-isFilledCoercionHole (CoercionHole { ch_ref = ref })
+isFilledCoercionHole (CH { ch_ref = ref })
= isJust <$> readTcRef ref
-- | Retrieve the contents of a coercion hole. Panics if the hole
@@ -631,7 +631,7 @@ unpackCoercionHole hole
-- | Retrieve the contents of a coercion hole, if it is filled
unpackCoercionHole_maybe :: CoercionHole -> ZonkM (Maybe CoercionPlusHoles)
-unpackCoercionHole_maybe (CoercionHole { ch_ref = ref }) = readTcRef ref
+unpackCoercionHole_maybe (CH { ch_ref = ref }) = readTcRef ref
{-
=====================================
compiler/GHC/Tc/Zonk/Type.hs
=====================================
@@ -485,7 +485,7 @@ zonkCoVarOcc cv
_ -> mkCoVarCo <$> (lift $ liftZonkM $ zonkCoVar cv) }
zonkCoHole :: CoercionHole -> ZonkTcM Coercion
-zonkCoHole hole@(CoercionHole { ch_ref = ref, ch_co_var = cv })
+zonkCoHole hole@(CH { ch_ref = ref, ch_co_var = cv })
= do { contents <- readTcRef ref
; case contents of
Just (CPH { cph_co = co })
@@ -1910,8 +1910,9 @@ zonk_tc_ev_binds (EvBinds bs) = zonkEvBinds bs
zonkEvBindsVar :: EvBindsVar -> ZonkBndrTcM (Bag EvBind)
zonkEvBindsVar (EvBindsVar { ebv_binds = ref })
- = do { bs <- readTcRef ref
+ = do { EBS { ebs_binds = bs } <- readTcRef ref
; zonkEvBinds (evBindMapBinds bs) }
+
zonkEvBindsVar (CoEvBindsVar {}) = return emptyBag
zonkEvBinds :: Bag EvBind -> ZonkBndrTcM (Bag EvBind)
=====================================
compiler/GHC/Types/Var.hs
=====================================
@@ -176,7 +176,7 @@ type KindVar = Var -- Definitely a kind variable
-- See Note [Evidence: EvIds and CoVars]
-- | Evidence Identifier
-type EvId = Id -- Term-level evidence: DictId, IpId, or EqVar
+type EvId = Id -- Term-level evidence: DictId, IpId, or CoVar
-- | Evidence Variable
type EvVar = EvId -- ...historical name for EvId
=====================================
compiler/GHC/Utils/Trace.hs
=====================================
@@ -11,6 +11,7 @@ module GHC.Utils.Trace
, warnPprTraceM
, pprTraceUserWarning
, trace
+ , traceCallStackDoc
)
where
=====================================
testsuite/tests/simplCore/should_compile/T26805.hs
=====================================
@@ -0,0 +1,29 @@
+{-# LANGUAGE GADTs #-}
+{-# LANGUAGE ImpredicativeTypes #-}
+{-# LANGUAGE TypeData #-}
+module T26805( interpret ) where
+
+import Data.Kind (Type)
+
+data Phantom (sh :: Type) = Phantom -- newtype fails to specialise as well
+
+instance Show (Phantom sh) where
+ show Phantom = "show"
+
+type Foo r = (forall sh. Show (Phantom sh), Num r)
+-- this specialises fine:
+-- type Foo r = (Num r)
+
+type data TK = TKScalar Type
+
+data AstTensor :: TK -> Type where
+ AstInt :: Int -> AstTensor (TKScalar Int)
+ AstPlus :: Foo r => AstTensor (TKScalar r) -> AstTensor (TKScalar r)
+
+plusConcrete :: Foo r => r -> r
+plusConcrete = (+ 1)
+
+interpret :: AstTensor (TKScalar Int) -> Int
+interpret v0 = case v0 of
+ AstInt n -> n
+ AstPlus u -> plusConcrete (interpret u)
=====================================
testsuite/tests/simplCore/should_compile/T26805.stderr
=====================================
@@ -0,0 +1 @@
+
\ No newline at end of file
=====================================
testsuite/tests/simplCore/should_compile/all.T
=====================================
@@ -578,3 +578,4 @@ test('T26615', [grep_errmsg(r'fEqList')], multimod_compile, ['T26615', '-O -fsp
# T26722: there should be no reboxing in $wg
test('T26722', [grep_errmsg(r'SPEC')], compile, ['-O -dno-typeable-binds'])
+test('T26805', [grep_errmsg(r'fromInteger')], compile, ['-O -dno-typeable-binds -ddump-simpl -dsuppress-uniques'])
=====================================
testsuite/tests/typecheck/should_compile/T26805a.hs
=====================================
@@ -0,0 +1,38 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE UndecidableSuperClasses #-}
+{-# LANGUAGE QuantifiedConstraints #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE RoleAnnotations #-}
+
+-- This is a cut-down version of the failure found in !15389
+-- when compiling the `constraints` package.
+-- We got a Lint error because the NeededEvIds stuff in the
+-- constraint solver forgot some needed variables.
+
+module T26805a where
+
+import GHC.Exts (Constraint)
+import Data.Kind
+
+data Dict :: Constraint -> Type where
+ Dict :: a => Dict a
+
+newtype a :- b = Sub (a => Dict b)
+type role (:-) nominal nominal
+
+-- | Instantiate a quantified @'ForallF' p f@ constraint at type @a@.
+instF :: forall p f a . ForallF p f :- p (f a)
+instF = Sub @(ForallF p f) @(p (f a))
+ (case inst :: Forall (ComposeC p f) :- ComposeC p f a of
+ Sub Dict -> Dict)
+
+class Forall (ComposeC p f) => ForallF (p :: k2 -> Constraint) (f :: k1 -> k2)
+
+class p (f a) => ComposeC (p :: k2 -> Constraint) (f :: k1 -> k2) (a :: k1)
+
+class (forall a. p a) => Forall (p :: k -> Constraint)
+instance (forall a. p a) => Forall (p :: k -> Constraint)
+
+inst :: forall p a. Forall p :- p a
+inst = Sub Dict
+
=====================================
testsuite/tests/typecheck/should_compile/all.T
=====================================
@@ -959,3 +959,5 @@ test('T26451', normal, compile, [''])
test('T26582', normal, compile, [''])
test('T26746', normal, compile, [''])
test('T26737', normal, compile, [''])
+test('T26805a', normal, compile, [''])
+
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3ff419a9fa70b975f74e20a65fe398bā¦
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3ff419a9fa70b975f74e20a65fe398bā¦
You're receiving this email because of your account on gitlab.haskell.org.
1
0
23 Jan '26
Cheng Shao pushed new branch wip/testing-use-deb at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/testing-use-deb
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc] Pushed new branch wip/jeltsch/stability-risk-3-module-deprecation
by Wolfgang Jeltsch (ļ¼ jeltsch) 23 Jan '26
by Wolfgang Jeltsch (ļ¼ jeltsch) 23 Jan '26
23 Jan '26
Wolfgang Jeltsch pushed new branch wip/jeltsch/stability-risk-3-module-deprecation at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/jeltsch/stability-risk-3-moduā¦
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: Export labelThread from Control.Concurrent
by Marge Bot (ļ¼ marge-bot) 23 Jan '26
by Marge Bot (ļ¼ marge-bot) 23 Jan '26
23 Jan '26
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
917ab8ff by Oleg Grenrus at 2026-01-23T10:52:55-05:00
Export labelThread from Control.Concurrent
- - - - -
3f5e8d80 by Cheng Shao at 2026-01-23T10:53:37-05:00
ci: only push perf notes on master/release branches
This patch fixes push_perf_notes logic in ci.sh to only push perf
notes on master/release branches. We used to unconditionally push perf
notes even in MRs, but the perf numbers in the wip branches wouldn't
be used as baseline anyway, plus this is causing a space leak in the
ghc-performance-notes repo. See #25317 for the perf notes repo size
problem.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
57a339d9 by Cheng Shao at 2026-01-23T12:27:33-05:00
hadrian: drop obsolete configure/make builder logic for libffi
This patch drops obsolete hadrian logic around `Configure
libffiPath`/`Make libffiPath` builders, they are no longer needed
after libffi-clib has landed. Closes #26815.
- - - - -
12aebc0c by Simon Hengel at 2026-01-23T12:27:34-05:00
Fix typo in roles.rst
- - - - -
12 changed files:
- .gitlab/ci.sh
- docs/users_guide/exts/roles.rst
- hadrian/src/Context.hs
- hadrian/src/Settings/Builders/Configure.hs
- hadrian/src/Settings/Builders/Make.hs
- libraries/base/changelog.md
- libraries/base/src/Control/Concurrent.hs
- libraries/base/src/System/Timeout.hs
- 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
Changes:
=====================================
.gitlab/ci.sh
=====================================
@@ -493,6 +493,11 @@ function fetch_perf_notes() {
}
function push_perf_notes() {
+ if [[ "${CI_COMMIT_BRANCH:-}" != "master" ]] && [[ ! "${CI_COMMIT_BRANCH:-}" =~ ghc-[0-9]+\.[0-9]+ ]]; then
+ info "Perf notes are only pushed on master/release branches"
+ return
+ fi
+
if [[ -z "${TEST_ENV:-}" ]]; then
return
fi
=====================================
docs/users_guide/exts/roles.rst
=====================================
@@ -38,7 +38,7 @@ trouble.
The way to identify such situations is to have *roles* assigned to type
variables of datatypes, classes, and type synonyms.
-Roles as implemented in GHC are a from a simplified version of the work
+Roles as implemented in GHC are based on a simplified version of the work
described in `Generative type abstraction and type-level
computation <https://www.seas.upenn.edu/~sweirich/papers/popl163af-weirich.pdf>`__,
published at POPL 2011.
=====================================
hadrian/src/Context.hs
=====================================
@@ -11,7 +11,7 @@ module Context (
pkgLibraryFile,
pkgConfFile, pkgStampFile, resourcePath, objectPath, contextPath, getContextPath, libPath, distDir,
distDynDir,
- haddockStatsFilesDir, ensureConfigured, autogenPath, rtsContext, rtsBuildPath, libffiBuildPath
+ haddockStatsFilesDir, ensureConfigured, autogenPath, rtsContext, rtsBuildPath
) where
import Base
@@ -93,14 +93,6 @@ rtsContext stage = vanillaContext stage rts
rtsBuildPath :: Stage -> Action FilePath
rtsBuildPath stage = buildPath (rtsContext stage)
--- | Build directory for in-tree 'libffi' library.
-libffiBuildPath :: Stage -> Action FilePath
-libffiBuildPath stage = buildPath $ Context
- stage
- libffi
- (error "libffiBuildPath: way not set.")
- (error "libffiBuildPath: inplace not set.")
-
pkgFileName :: Context -> Package -> String -> String -> Action FilePath
pkgFileName context package prefix suffix = do
pid <- pkgUnitId (stage context) package
=====================================
hadrian/src/Settings/Builders/Configure.hs
=====================================
@@ -8,8 +8,7 @@ configureBuilderArgs :: Args
configureBuilderArgs = do
stage <- getStage
gmpPath <- expr (gmpBuildPath stage)
- libffiPath <- expr (libffiBuildPath stage)
- mconcat [ builder (Configure gmpPath) ? do
+ builder (Configure gmpPath) ? do
targetArch <- queryTarget queryArch
targetPlatform <- queryTarget targetPlatformTriple
buildPlatform <- queryBuild targetPlatformTriple
@@ -28,16 +27,3 @@ configureBuilderArgs = do
-- option.
<> [ "--enable-alloca=malloc-notreentrant" | targetArch == "wasm32" ]
<> [ "--with-pic=yes" ]
-
- , builder (Configure libffiPath) ? do
- top <- expr topDirectory
- targetPlatform <- queryTarget targetPlatformTriple
- way <- getWay
- pure [ "--prefix=" ++ top -/- libffiPath -/- "inst"
- , "--libdir=" ++ top -/- libffiPath -/- "inst/lib"
- , "--enable-static=yes"
- , "--enable-shared="
- ++ (if wayUnit Dynamic way
- then "yes"
- else "no")
- , "--host=" ++ targetPlatform ] ]
=====================================
hadrian/src/Settings/Builders/Make.hs
=====================================
@@ -12,12 +12,8 @@ makeBuilderArgs = do
threads <- shakeThreads <$> expr getShakeOptions
stage <- getStage
gmpPath <- expr (gmpBuildPath stage)
- libffiPaths <- forM [Stage1, Stage2, Stage3 ] $ \s -> expr (libffiBuildPath s)
let t = show $ max 4 (threads - 2) -- Don't use all Shake's threads
- mconcat $
- (builder (Make gmpPath ) ? pure ["MAKEFLAGS=-j" ++ t]) :
- [ builder (Make libffiPath) ? pure ["MAKEFLAGS=-j" ++ t, "install"]
- | libffiPath <- libffiPaths ]
+ builder (Make gmpPath) ? pure ["MAKEFLAGS=-j" ++ t]
validateBuilderArgs :: Args
validateBuilderArgs = builder (Make "testsuite/tests") ? do
=====================================
libraries/base/changelog.md
=====================================
@@ -22,6 +22,7 @@
* `GHC.Conc.throwSTM` and `GHC.Conc.Sync.throwSTM` now carry a `HasCallStack` constraint and attach a `Backtrace` annotation to the thrown exception. ([GHC #25365](https://gitlab.haskell.org/ghc/ghc/-/issues/25365))
* `GHC.Conc.catchSTM` and `GHC.Conc.Sync.catchSTM` now attach `WhileHandling` annotation to exceptions thrown from the handler. ([GHC #25365](https://gitlab.haskell.org/ghc/ghc/-/issues/25365))
* Remove `GHC.JS.Prim.Internal.Build`, as per [CLC #329](https://github.com/haskell/core-libraries-committee/issues/329)
+ * Export `labelThread` from `Control.Concurrent`.([CLC proposal #376](https://github.com/haskell/core-libraries-committee/issues/376))
## 4.22.0.0 *TBA*
* Shipped with GHC 9.14.1
=====================================
libraries/base/src/Control/Concurrent.hs
=====================================
@@ -82,6 +82,9 @@ module Control.Concurrent (
-- * Weak references to ThreadIds
mkWeakThreadId,
+ -- * Thread debugging
+ labelThread,
+
-- * GHC's implementation of concurrency
-- |This section describes features specific to GHC's
=====================================
libraries/base/src/System/Timeout.hs
=====================================
@@ -29,7 +29,6 @@ import GHC.Internal.Control.Exception (Exception(..), handleJust, bracket,
asyncExceptionToException,
asyncExceptionFromException)
import GHC.Internal.Data.Unique (Unique, newUnique)
-import GHC.Conc (labelThread)
import Prelude
-- $setup
=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -120,6 +120,7 @@ module Control.Concurrent where
isCurrentThreadBound :: GHC.Internal.Types.IO GHC.Internal.Types.Bool
isEmptyMVar :: forall a. MVar a -> GHC.Internal.Types.IO GHC.Internal.Types.Bool
killThread :: ThreadId -> GHC.Internal.Types.IO ()
+ labelThread :: ThreadId -> GHC.Internal.Base.String -> GHC.Internal.Types.IO ()
mkWeakMVar :: forall a. MVar a -> GHC.Internal.Types.IO () -> GHC.Internal.Types.IO (GHC.Internal.Weak.Weak (MVar a))
mkWeakThreadId :: ThreadId -> GHC.Internal.Types.IO (GHC.Internal.Weak.Weak ThreadId)
modifyMVar :: forall a b. MVar a -> (a -> GHC.Internal.Types.IO (a, b)) -> GHC.Internal.Types.IO b
=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -120,6 +120,7 @@ module Control.Concurrent where
isCurrentThreadBound :: GHC.Internal.Types.IO GHC.Internal.Types.Bool
isEmptyMVar :: forall a. MVar a -> GHC.Internal.Types.IO GHC.Internal.Types.Bool
killThread :: ThreadId -> GHC.Internal.Types.IO ()
+ labelThread :: ThreadId -> GHC.Internal.Base.String -> GHC.Internal.Types.IO ()
mkWeakMVar :: forall a. MVar a -> GHC.Internal.Types.IO () -> GHC.Internal.Types.IO (GHC.Internal.Weak.Weak (MVar a))
mkWeakThreadId :: ThreadId -> GHC.Internal.Types.IO (GHC.Internal.Weak.Weak ThreadId)
modifyMVar :: forall a b. MVar a -> (a -> GHC.Internal.Types.IO (a, b)) -> GHC.Internal.Types.IO b
=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -120,6 +120,7 @@ module Control.Concurrent where
isCurrentThreadBound :: GHC.Internal.Types.IO GHC.Internal.Types.Bool
isEmptyMVar :: forall a. MVar a -> GHC.Internal.Types.IO GHC.Internal.Types.Bool
killThread :: ThreadId -> GHC.Internal.Types.IO ()
+ labelThread :: ThreadId -> GHC.Internal.Base.String -> GHC.Internal.Types.IO ()
mkWeakMVar :: forall a. MVar a -> GHC.Internal.Types.IO () -> GHC.Internal.Types.IO (GHC.Internal.Weak.Weak (MVar a))
mkWeakThreadId :: ThreadId -> GHC.Internal.Types.IO (GHC.Internal.Weak.Weak ThreadId)
modifyMVar :: forall a b. MVar a -> (a -> GHC.Internal.Types.IO (a, b)) -> GHC.Internal.Types.IO b
=====================================
testsuite/tests/interface-stability/base-exports.stdout-ws-32
=====================================
@@ -120,6 +120,7 @@ module Control.Concurrent where
isCurrentThreadBound :: GHC.Internal.Types.IO GHC.Internal.Types.Bool
isEmptyMVar :: forall a. MVar a -> GHC.Internal.Types.IO GHC.Internal.Types.Bool
killThread :: ThreadId -> GHC.Internal.Types.IO ()
+ labelThread :: ThreadId -> GHC.Internal.Base.String -> GHC.Internal.Types.IO ()
mkWeakMVar :: forall a. MVar a -> GHC.Internal.Types.IO () -> GHC.Internal.Types.IO (GHC.Internal.Weak.Weak (MVar a))
mkWeakThreadId :: ThreadId -> GHC.Internal.Types.IO (GHC.Internal.Weak.Weak ThreadId)
modifyMVar :: forall a b. MVar a -> (a -> GHC.Internal.Types.IO (a, b)) -> GHC.Internal.Types.IO b
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/eaa19c00d252bae43a2c333fc4a83fā¦
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/eaa19c00d252bae43a2c333fc4a83fā¦
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][master] ci: only push perf notes on master/release branches
by Marge Bot (ļ¼ marge-bot) 23 Jan '26
by Marge Bot (ļ¼ marge-bot) 23 Jan '26
23 Jan '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
3f5e8d80 by Cheng Shao at 2026-01-23T10:53:37-05:00
ci: only push perf notes on master/release branches
This patch fixes push_perf_notes logic in ci.sh to only push perf
notes on master/release branches. We used to unconditionally push perf
notes even in MRs, but the perf numbers in the wip branches wouldn't
be used as baseline anyway, plus this is causing a space leak in the
ghc-performance-notes repo. See #25317 for the perf notes repo size
problem.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
1 changed file:
- .gitlab/ci.sh
Changes:
=====================================
.gitlab/ci.sh
=====================================
@@ -493,6 +493,11 @@ function fetch_perf_notes() {
}
function push_perf_notes() {
+ if [[ "${CI_COMMIT_BRANCH:-}" != "master" ]] && [[ ! "${CI_COMMIT_BRANCH:-}" =~ ghc-[0-9]+\.[0-9]+ ]]; then
+ info "Perf notes are only pushed on master/release branches"
+ return
+ fi
+
if [[ -z "${TEST_ENV:-}" ]]; then
return
fi
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3f5e8d80b32063d265aeead6b62604cā¦
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3f5e8d80b32063d265aeead6b62604cā¦
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][master] Export labelThread from Control.Concurrent
by Marge Bot (ļ¼ marge-bot) 23 Jan '26
by Marge Bot (ļ¼ marge-bot) 23 Jan '26
23 Jan '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
917ab8ff by Oleg Grenrus at 2026-01-23T10:52:55-05:00
Export labelThread from Control.Concurrent
- - - - -
7 changed files:
- libraries/base/changelog.md
- libraries/base/src/Control/Concurrent.hs
- libraries/base/src/System/Timeout.hs
- 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
Changes:
=====================================
libraries/base/changelog.md
=====================================
@@ -22,6 +22,7 @@
* `GHC.Conc.throwSTM` and `GHC.Conc.Sync.throwSTM` now carry a `HasCallStack` constraint and attach a `Backtrace` annotation to the thrown exception. ([GHC #25365](https://gitlab.haskell.org/ghc/ghc/-/issues/25365))
* `GHC.Conc.catchSTM` and `GHC.Conc.Sync.catchSTM` now attach `WhileHandling` annotation to exceptions thrown from the handler. ([GHC #25365](https://gitlab.haskell.org/ghc/ghc/-/issues/25365))
* Remove `GHC.JS.Prim.Internal.Build`, as per [CLC #329](https://github.com/haskell/core-libraries-committee/issues/329)
+ * Export `labelThread` from `Control.Concurrent`.([CLC proposal #376](https://github.com/haskell/core-libraries-committee/issues/376))
## 4.22.0.0 *TBA*
* Shipped with GHC 9.14.1
=====================================
libraries/base/src/Control/Concurrent.hs
=====================================
@@ -82,6 +82,9 @@ module Control.Concurrent (
-- * Weak references to ThreadIds
mkWeakThreadId,
+ -- * Thread debugging
+ labelThread,
+
-- * GHC's implementation of concurrency
-- |This section describes features specific to GHC's
=====================================
libraries/base/src/System/Timeout.hs
=====================================
@@ -29,7 +29,6 @@ import GHC.Internal.Control.Exception (Exception(..), handleJust, bracket,
asyncExceptionToException,
asyncExceptionFromException)
import GHC.Internal.Data.Unique (Unique, newUnique)
-import GHC.Conc (labelThread)
import Prelude
-- $setup
=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -120,6 +120,7 @@ module Control.Concurrent where
isCurrentThreadBound :: GHC.Internal.Types.IO GHC.Internal.Types.Bool
isEmptyMVar :: forall a. MVar a -> GHC.Internal.Types.IO GHC.Internal.Types.Bool
killThread :: ThreadId -> GHC.Internal.Types.IO ()
+ labelThread :: ThreadId -> GHC.Internal.Base.String -> GHC.Internal.Types.IO ()
mkWeakMVar :: forall a. MVar a -> GHC.Internal.Types.IO () -> GHC.Internal.Types.IO (GHC.Internal.Weak.Weak (MVar a))
mkWeakThreadId :: ThreadId -> GHC.Internal.Types.IO (GHC.Internal.Weak.Weak ThreadId)
modifyMVar :: forall a b. MVar a -> (a -> GHC.Internal.Types.IO (a, b)) -> GHC.Internal.Types.IO b
=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -120,6 +120,7 @@ module Control.Concurrent where
isCurrentThreadBound :: GHC.Internal.Types.IO GHC.Internal.Types.Bool
isEmptyMVar :: forall a. MVar a -> GHC.Internal.Types.IO GHC.Internal.Types.Bool
killThread :: ThreadId -> GHC.Internal.Types.IO ()
+ labelThread :: ThreadId -> GHC.Internal.Base.String -> GHC.Internal.Types.IO ()
mkWeakMVar :: forall a. MVar a -> GHC.Internal.Types.IO () -> GHC.Internal.Types.IO (GHC.Internal.Weak.Weak (MVar a))
mkWeakThreadId :: ThreadId -> GHC.Internal.Types.IO (GHC.Internal.Weak.Weak ThreadId)
modifyMVar :: forall a b. MVar a -> (a -> GHC.Internal.Types.IO (a, b)) -> GHC.Internal.Types.IO b
=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -120,6 +120,7 @@ module Control.Concurrent where
isCurrentThreadBound :: GHC.Internal.Types.IO GHC.Internal.Types.Bool
isEmptyMVar :: forall a. MVar a -> GHC.Internal.Types.IO GHC.Internal.Types.Bool
killThread :: ThreadId -> GHC.Internal.Types.IO ()
+ labelThread :: ThreadId -> GHC.Internal.Base.String -> GHC.Internal.Types.IO ()
mkWeakMVar :: forall a. MVar a -> GHC.Internal.Types.IO () -> GHC.Internal.Types.IO (GHC.Internal.Weak.Weak (MVar a))
mkWeakThreadId :: ThreadId -> GHC.Internal.Types.IO (GHC.Internal.Weak.Weak ThreadId)
modifyMVar :: forall a b. MVar a -> (a -> GHC.Internal.Types.IO (a, b)) -> GHC.Internal.Types.IO b
=====================================
testsuite/tests/interface-stability/base-exports.stdout-ws-32
=====================================
@@ -120,6 +120,7 @@ module Control.Concurrent where
isCurrentThreadBound :: GHC.Internal.Types.IO GHC.Internal.Types.Bool
isEmptyMVar :: forall a. MVar a -> GHC.Internal.Types.IO GHC.Internal.Types.Bool
killThread :: ThreadId -> GHC.Internal.Types.IO ()
+ labelThread :: ThreadId -> GHC.Internal.Base.String -> GHC.Internal.Types.IO ()
mkWeakMVar :: forall a. MVar a -> GHC.Internal.Types.IO () -> GHC.Internal.Types.IO (GHC.Internal.Weak.Weak (MVar a))
mkWeakThreadId :: ThreadId -> GHC.Internal.Types.IO (GHC.Internal.Weak.Weak ThreadId)
modifyMVar :: forall a b. MVar a -> (a -> GHC.Internal.Types.IO (a, b)) -> GHC.Internal.Types.IO b
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/917ab8ff84157eeda54dbe818cdc7edā¦
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/917ab8ff84157eeda54dbe818cdc7edā¦
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/26699] 3 commits: hadrian: Bump QuickCheck upper bound
by recursion-ninja (ļ¼ recursion-ninja) 23 Jan '26
by recursion-ninja (ļ¼ recursion-ninja) 23 Jan '26
23 Jan '26
recursion-ninja pushed to branch wip/26699 at Glasgow Haskell Compiler / GHC
Commits:
be8e5236 by Ben Gamari at 2026-01-23T03:28:45-05:00
hadrian: Bump QuickCheck upper bound
This patch bumps QuickCheck upper bound to 2.18. selftest rule
manually tested to work with current latest QuickCheck-2.17.1.0.
- - - - -
5aa328fb by Zubin Duggal at 2026-01-23T03:29:30-05:00
Add genindex to index.rst. This adds a link to the index in the navigation bar.
Fixes #26437
- - - - -
5456a01f by Recursion Ninja at 2026-01-23T14:10:18+00:00
Migrating the simplest types required for Trees That Grow progress
from GHC.Types.Basic to Language.Haskell.Syntax.Basic. Related
function definitions were also moved. Outputable type-class instances
are defined in GHC.Utils.Outputable. Binary instance of Boxity was
moved to GHC.Utils.Binary.
Migrated types:
* TopLevelFlag
* RuleName
* TyConFlavour
* TypeOrData
* NewOrData
- - - - -
20 changed files:
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Errors/Types.hs
- compiler/GHC/Rename/Env.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Splice.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Utils/Env.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Types/Basic.hs
- compiler/GHC/Utils/Binary.hs
- compiler/GHC/Utils/Outputable.hs
- compiler/Language/Haskell/Syntax/Basic.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- docs/users_guide/index.rst
- hadrian/hadrian.cabal
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
- utils/haddock/haddock-api/src/Haddock/Convert.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
Changes:
=====================================
compiler/GHC/Hs/Decls.hs
=====================================
@@ -17,7 +17,7 @@ module GHC.Hs.Decls (
-- * Toplevel declarations
HsDecl(..), LHsDecl, HsDataDefn(..), HsDeriving, LHsFunDep,
HsDerivingClause(..), LHsDerivingClause, DerivClauseTys(..), LDerivClauseTys,
- NewOrData, newOrDataToFlavour, anyLConIsGadt,
+ NewOrData, newOrDataToFlavour, dataDefnConsNewOrData, anyLConIsGadt,
StandaloneKindSig(..), LStandaloneKindSig, standaloneKindSigName,
-- ** Class or type declarations
@@ -1106,6 +1106,11 @@ anyLConIsGadt xs = case toList xs of
{-# SPECIALIZE anyLConIsGadt :: [GenLocated l (ConDecl pass)] -> Bool #-}
{-# SPECIALIZE anyLConIsGadt :: DataDefnCons (GenLocated l (ConDecl pass)) -> Bool #-}
+dataDefnConsNewOrData :: DataDefnCons a -> NewOrData
+dataDefnConsNewOrData = \ case
+ NewTypeCon {} -> NewType
+ DataTypeCons {} -> DataType
+
{-
************************************************************************
* *
=====================================
compiler/GHC/Hs/Utils.hs
=====================================
@@ -53,6 +53,7 @@ module GHC.Hs.Utils(
-- * Bindings
mkFunBind, mkVarBind, mkHsVarBind, mkSimpleGeneratedFunBind, mkTopFunBind,
mkPatSynBind,
+ familyInfoTyConFlavour,
isInfixFunBind,
spanHsLocaLBinds,
@@ -148,6 +149,7 @@ import Control.Arrow ( first )
import Data.Foldable ( toList )
import Data.List ( partition )
import Data.List.NonEmpty ( NonEmpty (..), nonEmpty )
+import Data.Maybe ( isNothing )
import qualified Data.List.NonEmpty as NE
import Data.IntMap ( IntMap )
@@ -1502,6 +1504,18 @@ hsLTyClDeclBinders (L loc (DataDecl { tcdLName = (L _ name)
where
flav = newOrDataToFlavour $ dataDefnConsNewOrData $ dd_cons defn
+familyInfoTyConFlavour
+ :: Maybe tc -- ^ Just cls <=> this is an associated family of class cls
+ -> FamilyInfo pass
+ -> TyConFlavour tc
+familyInfoTyConFlavour mb_parent_tycon info =
+ case info of
+ DataFamily -> OpenFamilyFlavour (IAmData DataType) mb_parent_tycon
+ OpenTypeFamily -> OpenFamilyFlavour IAmType mb_parent_tycon
+ ClosedTypeFamily _ -> assert (isNothing mb_parent_tycon)
+ -- See Note [Closed type family mb_parent_tycon]
+ ClosedTypeFamilyFlavour
+
-------------------
hsForeignDeclsBinders :: forall p a. (UnXRec (GhcPass p), IsSrcSpanAnn p a)
=> [LForeignDecl (GhcPass p)] -> [LIdP (GhcPass p)]
=====================================
compiler/GHC/HsToCore/Errors/Types.hs
=====================================
@@ -4,7 +4,7 @@ module GHC.HsToCore.Errors.Types where
import GHC.Prelude
-import GHC.Core (CoreRule, CoreExpr, RuleName)
+import GHC.Core (CoreRule, CoreExpr)
import GHC.Core.DataCon
import GHC.Core.ConLike
import GHC.Core.Type
=====================================
compiler/GHC/Rename/Env.hs
=====================================
@@ -80,7 +80,7 @@ import GHC.Core.ConLike
import GHC.Core.DataCon
import GHC.Core.TyCon
import GHC.Builtin.Names( rOOT_MAIN )
-import GHC.Types.Basic ( TopLevelFlag(..), TupleSort(..), tupleSortBoxity )
+import GHC.Types.Basic ( TupleSort(..), tupleSortBoxity )
import GHC.Types.TyThing ( tyThingGREInfo )
import GHC.Types.SrcLoc as SrcLoc
import GHC.Utils.Outputable as Outputable
=====================================
compiler/GHC/Rename/Module.hs
=====================================
@@ -52,7 +52,7 @@ import GHC.Types.ForeignCall ( CCallTarget(..) )
import GHC.Types.Name
import GHC.Types.Name.Set
import GHC.Types.Name.Env
-import GHC.Types.Basic ( VisArity, TyConFlavour(..), TypeOrKind(..), RuleName )
+import GHC.Types.Basic ( VisArity, TyConFlavour(..), TypeOrKind(..) )
import GHC.Types.GREInfo (ConLikeInfo (..), ConInfo, mkConInfo, conInfoFields)
import GHC.Types.Hint (SigLike(..))
import GHC.Types.Unique.Set
=====================================
compiler/GHC/Rename/Names.hs
=====================================
@@ -70,7 +70,7 @@ import GHC.Types.FieldLabel
import GHC.Types.Hint
import GHC.Types.SourceFile
import GHC.Types.SrcLoc as SrcLoc
-import GHC.Types.Basic ( TopLevelFlag(..), TyConFlavour (..), convImportLevel )
+import GHC.Types.Basic ( TyConFlavour (..), convImportLevel )
import GHC.Types.SourceText
import GHC.Types.Id
import GHC.Types.PkgQual
=====================================
compiler/GHC/Rename/Splice.hs
=====================================
@@ -32,7 +32,7 @@ import GHC.Rename.Unbound ( isUnboundName )
import GHC.Rename.Module ( rnSrcDecls, findSplice )
import GHC.Rename.Pat ( rnPat )
import GHC.Types.Error
-import GHC.Types.Basic ( TopLevelFlag, isTopLevel, maxPrec )
+import GHC.Types.Basic ( maxPrec )
import GHC.Types.SourceText ( SourceText(..) )
import GHC.Types.ThLevelIndex
import GHC.Utils.Outputable
=====================================
compiler/GHC/Tc/Gen/Head.hs
=====================================
@@ -62,7 +62,6 @@ import GHC.Types.Id
import GHC.Types.Name
import GHC.Types.Name.Reader
import GHC.Types.SrcLoc
-import GHC.Types.Basic
import GHC.Types.Error
import GHC.Builtin.Names
=====================================
compiler/GHC/Tc/Utils/Env.hs
=====================================
@@ -119,7 +119,6 @@ import GHC.Data.List.SetOps
import GHC.Data.Maybe( MaybeErr(..), orElse, maybeToList, fromMaybe )
import GHC.Types.SrcLoc
-import GHC.Types.Basic hiding( SuccessFlag(..) )
import GHC.Types.TypeEnv
import GHC.Types.SourceFile
import GHC.Types.Name
=====================================
compiler/GHC/Tc/Utils/Monad.hs
=====================================
@@ -239,7 +239,7 @@ import GHC.Types.Unique.DFM
import GHC.Types.Unique.Supply
import GHC.Types.Unique (uniqueTag)
import GHC.Types.Annotations
-import GHC.Types.Basic( TopLevelFlag(..), TypeOrKind(..) )
+import GHC.Types.Basic( TypeOrKind(..) )
import GHC.Types.CostCentre.State
import GHC.Types.SourceFile
=====================================
compiler/GHC/Types/Basic.hs
=====================================
@@ -103,7 +103,6 @@ module GHC.Types.Basic (
import GHC.Prelude
import GHC.ForeignSrcLang
-import GHC.Data.FastString
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Binary
@@ -111,15 +110,16 @@ import GHC.Types.Arity
import GHC.Types.SourceText
import qualified GHC.LanguageExtensions as LangExt
import {-# SOURCE #-} Language.Haskell.Syntax.Type (PromotionFlag(..), isPromoted)
-import Language.Haskell.Syntax.Basic (Boxity(..), isBoxed, ConTag)
import {-# SOURCE #-} Language.Haskell.Syntax.Expr (HsDoFlavour)
+
+import Language.Haskell.Syntax.Basic
+import Language.Haskell.Syntax.ImpExp
+
import Control.DeepSeq ( NFData(..) )
import Data.Data
import Data.Maybe
import qualified Data.Semigroup as Semi
-import Language.Haskell.Syntax.ImpExp
-
{-
************************************************************************
* *
@@ -420,55 +420,10 @@ instance NFData FunctionOrData where
************************************************************************
-}
-type RuleName = FastString
-
pprRuleName :: RuleName -> SDoc
pprRuleName rn = doubleQuotes (ftext rn)
-{-
-************************************************************************
-* *
-\subsection[Top-level/local]{Top-level/not-top level flag}
-* *
-************************************************************************
--}
-
-data TopLevelFlag
- = TopLevel
- | NotTopLevel
- deriving Data
-
-isTopLevel, isNotTopLevel :: TopLevelFlag -> Bool
-
-isNotTopLevel NotTopLevel = True
-isNotTopLevel TopLevel = False
-
-isTopLevel TopLevel = True
-isTopLevel NotTopLevel = False
-
-instance Outputable TopLevelFlag where
- ppr TopLevel = text "<TopLevel>"
- ppr NotTopLevel = text "<NotTopLevel>"
-
-{-
-************************************************************************
-* *
- Boxity flag
-* *
-************************************************************************
--}
-
-instance Outputable Boxity where
- ppr Boxed = text "Boxed"
- ppr Unboxed = text "Unboxed"
-
-instance Binary Boxity where -- implemented via isBoxed-isomorphism to Bool
- put_ bh = put_ bh . isBoxed
- get bh = do
- b <- get bh
- pure $ if b then Boxed else Unboxed
-
{-
************************************************************************
* *
@@ -1524,11 +1479,13 @@ instance NFData TypeOrConstraint where
TypeLike -> ()
ConstraintLike -> ()
-{- *********************************************************************
+{-
+************************************************************************
* *
- TyConFlavour
+TyConFlavour
* *
-********************************************************************* -}
+************************************************************************
+-}
-- | Paints a picture of what a 'TyCon' represents, in broad strokes.
-- This is used towards more informative error messages.
@@ -1571,7 +1528,6 @@ instance Outputable (TyConFlavour tc) where
go BuiltInTypeFlavour = "built-in type"
go PromotedDataConFlavour = "promoted data constructor"
-
-- | Get the enclosing class TyCon (if there is one) for the given TyConFlavour
tyConFlavourAssoc_maybe :: TyConFlavour tc -> Maybe tc
tyConFlavourAssoc_maybe (OpenFamilyFlavour _ mb_parent) = mb_parent
@@ -1584,22 +1540,10 @@ data TypeOrData
| IAmType
deriving (Eq, Data)
--- | When we only care whether a data-type declaration is `data` or `newtype`,
--- but not what constructors it has.
-data NewOrData
- = NewType -- ^ @newtype Blah ...@
- | DataType -- ^ @data Blah ...@
- deriving ( Eq, Data ) -- Needed because Demand derives Eq
-
instance Outputable TypeOrData where
ppr (IAmData newOrData) = ppr newOrData
ppr IAmType = text "type"
-instance Outputable NewOrData where
- ppr = \case
- NewType -> text "newtype"
- DataType -> text "data"
-
{- *********************************************************************
* *
Defaulting options
=====================================
compiler/GHC/Utils/Binary.hs
=====================================
@@ -117,6 +117,7 @@ module GHC.Utils.Binary
import GHC.Prelude
+import Language.Haskell.Syntax.Basic
import Language.Haskell.Syntax.Binds.InlinePragma
import Language.Haskell.Syntax.Module.Name (ModuleName(..))
import Language.Haskell.Syntax.ImpExp.IsBoot (IsBootInterface(..))
@@ -2011,6 +2012,12 @@ instance NFData a => NFData (FingerprintWithValue a) where
rnf (FingerprintWithValue fp mflags)
= rnf fp `seq` rnf mflags `seq` ()
+instance Binary Boxity where -- implemented via isBoxed-isomorphism to Bool
+ put_ bh = put_ bh . isBoxed
+ get bh = do
+ b <- get bh
+ pure $ if b then Boxed else Unboxed
+
instance Binary ConInfoTable where
get bh = Binary.decode <$> get bh
=====================================
compiler/GHC/Utils/Outputable.hs
=====================================
@@ -112,6 +112,7 @@ module GHC.Utils.Outputable (
import {-# SOURCE #-} GHC.Unit.Types ( Unit, Module, moduleName )
import {-# SOURCE #-} GHC.Types.Name.Occurrence( OccName )
+import Language.Haskell.Syntax.Basic
import Language.Haskell.Syntax.Binds.InlinePragma
import Language.Haskell.Syntax.Module.Name ( ModuleName(..) )
@@ -2001,19 +2002,32 @@ instance IsDoc HDoc where
{-# INLINE CONLIKE dualDoc #-}
instance Outputable (ActivationX p) where
- ppr AlwaysActive = empty
- ppr NeverActive = brackets (text "~")
- ppr (ActiveBefore n) = brackets (char '~' <> int n)
- ppr (ActiveAfter n) = brackets (int n)
- ppr (XActivation _) = text "[final]"
+ ppr AlwaysActive = empty
+ ppr NeverActive = brackets (text "~")
+ ppr (ActiveBefore n) = brackets (char '~' <> int n)
+ ppr (ActiveAfter n) = brackets (int n)
+ ppr (XActivation _) = text "[final]"
instance Outputable InlineSpec where
- ppr Inline = text "INLINE"
- ppr NoInline = text "NOINLINE"
- ppr Inlinable = text "INLINABLE"
- ppr Opaque = text "OPAQUE"
- ppr NoUserInlinePrag = empty
+ ppr Inline = text "INLINE"
+ ppr NoInline = text "NOINLINE"
+ ppr Inlinable = text "INLINABLE"
+ ppr Opaque = text "OPAQUE"
+ ppr NoUserInlinePrag = empty
+
+instance Outputable Boxity where
+ ppr Boxed = text "Boxed"
+ ppr Unboxed = text "Unboxed"
instance Outputable RuleMatchInfo where
- ppr ConLike = text "CONLIKE"
- ppr FunLike = text "FUNLIKE"
+ ppr ConLike = text "CONLIKE"
+ ppr FunLike = text "FUNLIKE"
+
+instance Outputable NewOrData where
+ ppr = \case
+ NewType -> text "newtype"
+ DataType -> text "data"
+
+instance Outputable TopLevelFlag where
+ ppr TopLevel = text "<TopLevel>"
+ ppr NotTopLevel = text "<NotTopLevel>"
=====================================
compiler/Language/Haskell/Syntax/Basic.hs
=====================================
@@ -10,6 +10,37 @@ import Prelude
import GHC.Data.FastString (FastString)
import Control.DeepSeq
+{-
+************************************************************************
+* *
+Rules
+* *
+************************************************************************
+-}
+
+type RuleName = FastString
+
+{-
+************************************************************************
+* *
+\subsection[Top-level/local]{Top-level/not-top level flag}
+* *
+************************************************************************
+-}
+
+data TopLevelFlag
+ = TopLevel
+ | NotTopLevel
+ deriving Data
+
+isTopLevel, isNotTopLevel :: TopLevelFlag -> Bool
+
+isNotTopLevel NotTopLevel = True
+isNotTopLevel TopLevel = False
+
+isTopLevel TopLevel = True
+isTopLevel NotTopLevel = False
+
{-
************************************************************************
* *
@@ -125,3 +156,10 @@ data Fixity = Fixity Int FixityDirection
instance NFData Fixity where
rnf (Fixity i d) = rnf i `seq` rnf d `seq` ()
+
+-- | When we only care whether a data-type declaration is `data` or `newtype`,
+-- but not what constructors it has.
+data NewOrData
+ = NewType -- ^ @newtype Blah ...@
+ | DataType -- ^ @data Blah ...@
+ deriving ( Eq, Data ) -- Needed because Demand derives Eq
=====================================
compiler/Language/Haskell/Syntax/Decls.hs
=====================================
@@ -18,7 +18,7 @@ module Language.Haskell.Syntax.Decls (
-- * Toplevel declarations
HsDecl(..), LHsDecl, HsDataDefn(..), HsDeriving, LHsFunDep, FunDep(..),
HsDerivingClause(..), LHsDerivingClause, DerivClauseTys(..), LDerivClauseTys,
- NewOrData(..), DataDefnCons(..), dataDefnConsNewOrData,
+ NewOrData(..), DataDefnCons(..),
isTypeDataDefnCons, firstDataDefnCon,
StandaloneKindSig(..), LStandaloneKindSig,
@@ -31,7 +31,7 @@ module Language.Haskell.Syntax.Decls (
FamilyDecl(..), LFamilyDecl,
-- ** Instance declarations
- InstDecl(..), LInstDecl, FamilyInfo(..), familyInfoTyConFlavour,
+ InstDecl(..), LInstDecl, FamilyInfo(..),
TyFamInstDecl(..), LTyFamInstDecl,
TyFamDefltDecl, LTyFamDefltDecl,
DataFamInstDecl(..), LDataFamInstDecl,
@@ -91,6 +91,7 @@ import {-# SOURCE #-} Language.Haskell.Syntax.Expr
( HsExpr, HsUntypedSplice )
-- Because Expr imports Decls via HsBracket
+import Language.Haskell.Syntax.Basic (TopLevelFlag, RuleName, NewOrData(..))
import Language.Haskell.Syntax.Binds
import Language.Haskell.Syntax.Binds.InlinePragma (Activation)
import Language.Haskell.Syntax.Extension
@@ -98,8 +99,7 @@ import Language.Haskell.Syntax.Type
import Language.Haskell.Syntax.Basic (Role, LexicalFixity)
import Language.Haskell.Syntax.Specificity (Specificity)
-import GHC.Types.Basic (TopLevelFlag, OverlapMode, RuleName
- ,TyConFlavour(..), TypeOrData(..), NewOrData(..))
+import GHC.Types.Basic (OverlapMode)
import GHC.Types.ForeignCall (CType, CCallConv, Safety, Header, CLabelString, CCallTarget, CExportSpec)
import GHC.Data.FastString (FastString)
@@ -108,7 +108,6 @@ import GHC.Hs.Doc (WithHsDocIdentifiers)
import GHC.Types.SourceText (StringLiteral)
import Control.DeepSeq
-import Control.Exception (assert)
import Control.Monad
import Data.Data hiding (TyCon, Fixity, Infix)
import Data.Maybe
@@ -779,18 +778,6 @@ data FamilyInfo pass
-- said "type family Foo x where .."
| ClosedTypeFamily (Maybe [LTyFamInstEqn pass])
-familyInfoTyConFlavour
- :: Maybe tc -- ^ Just cls <=> this is an associated family of class cls
- -> FamilyInfo pass
- -> TyConFlavour tc
-familyInfoTyConFlavour mb_parent_tycon info =
- case info of
- DataFamily -> OpenFamilyFlavour (IAmData DataType) mb_parent_tycon
- OpenTypeFamily -> OpenFamilyFlavour IAmType mb_parent_tycon
- ClosedTypeFamily _ -> assert (isNothing mb_parent_tycon)
- -- See Note [Closed type family mb_parent_tycon]
- ClosedTypeFamilyFlavour
-
{- Note [Closed type family mb_parent_tycon]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There's no way to write a closed type family inside a class declaration:
@@ -932,11 +919,6 @@ data DataDefnCons a
[a] -- The (possibly empty) list of data constructors
deriving ( Eq, Data, Foldable, Functor, Traversable ) -- Needed because Demand derives Eq
-dataDefnConsNewOrData :: DataDefnCons a -> NewOrData
-dataDefnConsNewOrData = \ case
- NewTypeCon {} -> NewType
- DataTypeCons {} -> DataType
-
-- | Are the constructors within a @type data@ declaration?
-- See Note [Type data declarations] in GHC.Rename.Module.
isTypeDataDefnCons :: DataDefnCons a -> Bool
=====================================
docs/users_guide/index.rst
=====================================
@@ -29,6 +29,7 @@ Contents:
eventlog-formats
glossary
editing-guide
+ genindex
Indices and tables
=====================================
hadrian/hadrian.cabal
=====================================
@@ -190,4 +190,4 @@ executable hadrian
if flag(selftest)
other-modules: Rules.Selftest
cpp-options: -DHADRIAN_ENABLE_SELFTEST
- build-depends: QuickCheck >= 2.6 && < 2.15
+ build-depends: QuickCheck >= 2.6 && < 2.18
=====================================
utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
=====================================
@@ -33,7 +33,6 @@ import GHC
import GHC.Core.InstEnv
import qualified GHC.Driver.DynFlags as DynFlags
import GHC.Driver.Ppr
-import GHC.Plugins (TopLevelFlag (..))
import GHC.Types.SourceText
import GHC.Unit.State
import GHC.Utils.Outputable as Outputable
=====================================
utils/haddock/haddock-api/src/Haddock/Convert.hs
=====================================
@@ -59,7 +59,7 @@ import GHC.Core.TyCo.Rep
import GHC.Core.TyCon
import GHC.Core.Type
import GHC.Hs
-import GHC.Types.Basic (DefMethSpec (..), TopLevelFlag (..), TupleSort (..))
+import GHC.Types.Basic (DefMethSpec (..), TupleSort (..))
import GHC.Types.Id (idType, setIdType)
import GHC.Types.Name
import GHC.Types.Name.Reader (mkVarUnqual)
=====================================
utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
=====================================
@@ -37,7 +37,7 @@ import GHC hiding (NoLink, HsTypeGhcPsExt (..))
import GHC.Builtin.Types (eqTyCon_RDR, tupleDataConName, tupleTyConName)
import GHC.Core.TyCon (tyConResKind)
import GHC.Driver.DynFlags (getDynFlags)
-import GHC.Types.Basic (TopLevelFlag (..), TupleSort (..))
+import GHC.Types.Basic (TupleSort (..))
import GHC.Types.Name
import GHC.Types.Name.Reader (RdrName (Exact))
import Language.Haskell.Syntax.BooleanFormula(BooleanFormula(..))
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d970f2bb8e0c5d173becef1c1aa8f1ā¦
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d970f2bb8e0c5d173becef1c1aa8f1ā¦
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/jeltsch/obtaining-os-handles] 152 commits: X86 CodeGen: fix assign_eax_sse_regs
by Wolfgang Jeltsch (ļ¼ jeltsch) 23 Jan '26
by Wolfgang Jeltsch (ļ¼ jeltsch) 23 Jan '26
23 Jan '26
Wolfgang Jeltsch pushed to branch wip/jeltsch/obtaining-os-handles at Glasgow Haskell Compiler / GHC
Commits:
fca9cd7c by sheaf at 2025-12-18T13:18:18-05:00
X86 CodeGen: fix assign_eax_sse_regs
We must set %al to the number of SSE2 registers that contain arguments
(in case we are dealing with a varargs function). The logic for counting
how many arguments reside in SSE2 registers was incorrect, as it used
'isFloatFormat', which incorrectly ignores vector registers.
We now instead do case analysis on the register class:
is_sse_reg r =
case targetClassOfReg platform r of
RcFloatOrVector -> True
RcInteger -> False
This change is necessary to prevent segfaults in T20030_test1j, because
subsequent commits change the format calculations, resulting in vector
formats more often.
- - - - -
53150617 by sheaf at 2025-12-18T13:18:19-05:00
X86 regUsageOfInstr: fix format for IMUL
When used with 8-bit operands, the IMUL instruction returns the result
in the lower 16 bits of %rax (also known as %ax). This is different
than for the other sizes, where an input at 16, 32 or 64 bits will
result in 16, 32 or 64 bits of output in both %rax and %rdx.
This doesn't affect the behaviour of the compiler, because we don't
allow partial writes at sub-word sizes. The rationale is explained
in Wrinkle [Don't allow scalar partial writes] in Note [Register formats in liveness analysis],
in GHC.CmmToAsm.Reg.Liveness.
- - - - -
c7a56dd1 by sheaf at 2025-12-18T13:18:19-05:00
Liveness analysis: consider register formats
This commit updates the register allocator to be a bit more careful in
situations in which a single register is used at multiple different
formats, e.g. when xmm1 is used both to store a Double# and a DoubleX2#.
This is done by introducing the 'Regs' newtype around 'UniqSet RegWithFormat',
for which the combining operations take the larger of the two formats
instead of overriding the format.
Operations on 'Regs' are defined in 'GHC.CmmToAsm.Reg.Regs'. There is
a modest compile-time cost for the additional overhead for tracking
register formats, which causes the metric increases of this commit.
The subtle aspects of the implementation are outlined in
Note [Register formats in liveness analysis] in GHC.CmmToAsm.Reg.Liveness.
Fixes #26411 #26611
-------------------------
Metric Increase:
T12707
T26425
T3294
-------------------------
- - - - -
c2e83339 by sheaf at 2025-12-18T13:18:19-05:00
Register allocator: reload at same format as spill
This commit ensures that if we spill a register onto the stack at a
given format, we then always reload the register at this same format.
This ensures we don't end up in a situation where we spill F64x2 but end
up only reloading the lower F64. This first reload would make us believe
the whole data is in a register, thus silently losing the upper 64 bits
of the spilled register's contents.
Fixes #26526
- - - - -
55ab583b by sheaf at 2025-12-18T13:18:19-05:00
Register allocation: writes redefine format
As explained in Note [Allocated register formats] in GHC.CmmToAsm.Reg.Linear,
we consider all writes to redefine the format of the register.
This ensures that in a situation such as
movsd .Ln6m(%rip),%v1
shufpd $0,%v1,%v1
we properly consider the broadcast operation to change the format of %v1
from F64 to F64x2.
This completes the fix to #26411 (test in T26411b).
- - - - -
951402ed by Vladislav Zavialov at 2025-12-18T13:19:05-05:00
Parser: improve mkModuleImpExp, remove checkImportSpec
1. The `mkModuleImpExp` helper now knows whether it is processing an import or
export list item, and uses this information to produce a more accurate error
message for `import M (T(..,x))` with PatternSynonyms disabled.
The old message incorrectly referred to this case as an export form.
2. The `checkImportSpec` helper is removed in favor of more comprehensive error
checking in `mkModuleImpExp`.
3. Additionaly, the invariants of `ImpExpList` and `ImpExpAllWith` have been
made more explicit in the comments and assertions (calls to 'panic').
Test case: import-syntax-no-ext
- - - - -
47d83d96 by Vladislav Zavialov at 2025-12-18T13:19:06-05:00
Subordinate namespace-specified wildcards (#25901)
Add support for subordinate namespace-specified wildcards
`X(type ..)` and `X(data ..)` to import and export lists.
Examples:
import M (Cls(type ..)) -- imports Cls and all its associated types
import M (Cls(data ..)) -- imports Cls and all its methods
module M (R(data ..), C(type ..)) where
-- exports R and all its data constructors and record fields;
-- exports C and all its associated types, but not its methods
The scope of this change is limited to the case where the wildcard is the only
subordinate import/export item, whereas the more complex forms `X(type .., f)`
or `X(type .., data ..)` are unsupported and raise the newly introduced
PsErrUnsupportedExplicitNamespace error. This restriction may be lifted later.
Summary of the changes:
1. Refactor IEThingAll to store its extension field XIEThingAll as a record
IEThingAllExt instead of a tuple.
2. Extend the AST by adding a NamespaceSpecifier field to IEThingAllExt,
representing an optional namespace specifier `type` or `data` in front
of a subordinate wildcard `X(..)`.
3. Extend the grammar in Parser.y with productions for `type ..` and `data ..`
in subordinate import/export items.
4. Introduce `filterByNamespaceGREs` to filter [GlobalRdrElt] by a
NamespaceSpecifier; use it in `filterImports` and `exports_from_avail`
to account for the namespace specifier in IEThingAll.
5. Improve diagnostics by storing more information in DodgyImportsEmptyParent
and DodgyExportsEmptyParent.
Test cases:
T25901_sub_e T25901_sub_f T25901_sub_g T25901_sub_a
T25901_sub_b T25901_sub_c T25901_sub_d T25901_sub_w
DodgyImports02 DodgyImports03 DodgyImports04
- - - - -
eac418bb by Recursion Ninja at 2025-12-18T13:19:48-05:00
Removing the 'Data' instance for 'InstEnv'.
The 'Data' instance is blocking work on Trees that Grow, and the
'Data' instance seem to have been added without a clear purpose.
- - - - -
e920e038 by Recursion Ninja at 2025-12-18T13:19:48-05:00
'Decouple Language.Haskell.Syntax.Decls' from 'GHC.Unit.Module.Warnings'
- - - - -
bd38b76c by Cheng Shao at 2025-12-18T13:20:31-05:00
testsuite: improve coverage of foundation test
This patch refactors the `foundation` test a bit to improve coverage:
- Instead of using a hard-coded seed, a random seed is now taken from
the command line, and printed upon test failure. This improves test
coverage over many future CI runs, and shall a failure occur, the
seed is available in the CI log for local reproduction.
- The iterations count is bumped to 1000 instead of 100, similar to
the bump in `test-primops`. Runtime timeout is bumped 2x just to be
safe.
- Improve `newLCGGen` by using non-atomic loads/stores on a
`MutableByteArray#` for storing mutable `Word64`, this test doesn't
use parallelism in the first place
- Fixed a few compiler warnings and removed redundant pragmas and
imports
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
3995187c by Sylvain Henry at 2025-12-18T13:21:45-05:00
Doc: document -pgmi "" (#26634)
- - - - -
5729418c by Cheng Shao at 2025-12-18T13:22:29-05:00
rts: use __builtin_mul_overflow for hs_mulIntMayOflo
This patch uses `__builtin_mul_overflow` to implement
`hs_mulIntMayOflo`. This is a GNU C checked arithmetic builtin
function supported by gcc/clang, is type-generic so works for both
32-bit/64-bit, and makes the code both more efficient and easier to
read/maintain than the previous hand rolled logic.
- - - - -
1ca4b49a by Cheng Shao at 2025-12-18T13:23:11-05:00
compiler/rts: fix ABI mismatch in barf() invocations
This patch fixes a long-standing issue of ABI mismatch in `barf()`
invocations, both in compiler-emitted code and in hand written Cmm
code:
- In RTS, we have `barf()` which reports a fatal internal error
message and exits the program.
- `barf()` is a variadic C function! When used as a callee of a
foreign call with `ccall` calling convention instead of `capi`,
there is an ABI mismatch between the caller and the callee!
- Unfortunately, both the compiler and the Cmm sources contain many
places where we call `barf()` via `ccall` convention!! Like, when
you write `foreign "C" barf("foo object (%p) entered!", R1)`, it
totally doesn't do what you think it'll do at all!! The second
argument `R1` is not properly passed in `va_list`, and the behavior
is completely undefined!!
- Even more unfortunately, this issue has been sitting around long
enough because the ABI mismatch is subtle enough on normie platforms
like x64 and arm64.
- But there are platforms like wasm32 that are stricter about ABI, and
the broken `barf()` invocations already causes trouble for wasm
backend: we had to use ugly hacks like `barf(errmsg, NULL)` to make
`wasm-ld` happy, and even with this band-aid, compiler-generated
`barf()` invocations are still broken, resulting in regressions in
certain debug-related functionality, e.g. `-dtag-inference-checks`
is broken on wasm32 (#22882).
This patch properly fixes the issue:
- We add non-variadic `barf` wrappers in the RTS that can be used as
`ccall` callees
- Both the compiler `emitBarf` logic and the hand-written Cmm are
changed to call these wrappers
- `emitBarf` now also properly annotates the foreign call as
`CmmNeverReturns` to indicate it's a noreturn call to enable more
efficient code generation
`-dtag-inference-checks` now works on wasm. Closes #22882.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
b3dd23b9 by Vilim Lendvaj at 2025-12-18T13:23:57-05:00
Remove outdated comment
The Traversable instance for ZipList is no longer in
GHC.Internal.Data.Traversable. In fact, it is right below this very comment.
- - - - -
9a9c2f03 by Cheng Shao at 2025-12-18T13:24:39-05:00
compiler: remove unused OtherSection logic
This patch removes the OtherSection logic in Cmm, given it's never
actually used by any of our backends.
- - - - -
91edd292 by Wolfgang Jeltsch at 2025-12-19T03:18:19-05:00
Remove unused known-key and name variables for generics
This removes the known-key and corresponding name variables for `K1`,
`M1`, `R`, `D`, `C`, `S`, and `URec` from `GHC.Generics`, as they are
apparently nowhere used in GHCās source code.
- - - - -
73ee7e38 by Wolfgang Jeltsch at 2025-12-19T03:19:02-05:00
Remove unused known keys and names for generics classes
This removes the known-key and corresponding name variables for
`Datatype`, `Constructor`, and `Selector` from `GHC.Generics`, as they
are apparently nowhere used in GHCās source code.
- - - - -
f69c5f14 by Cheng Shao at 2025-12-19T03:19:45-05:00
wasm: fix handling of ByteArray#/MutableByteArray# arguments in JSFFI imports
This patch fixes the handling of ByteArray#/MutableByteArray#
arguments in JSFFI imports, see the amended note and manual for
explanation. Also adds a test to witness the fix.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
224446a2 by Cheng Shao at 2025-12-20T07:49:54-05:00
rts: workaround -Werror=maybe-uninitialized false positives
In some cases gcc might report -Werror=maybe-uninitialized that we
know are false positives, but need to workaround it to make validate
builds with -Werror pass.
- - - - -
251ec087 by Cheng Shao at 2025-12-20T07:49:54-05:00
hadrian: use -Og as C/C++ optimization level when debugging
This commit enables -Og as optimization level when compiling the debug
ways of rts. According to gcc documentation
(https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-Og)
-Og is a better choice than -O0 for producing debuggable code. It's
also supported by clang as well, so it makes sense to use it as a
default for debugging. Also add missing -g3 flag to C++ compilation
flags in +debug_info flavour transformer.
- - - - -
fb586c67 by Cheng Shao at 2025-12-20T07:50:36-05:00
compiler: replace DList with OrdList
This patch removes `DList` logic from the compiler and replaces it
with `OrdList` which also supports O(1) concatenation and should be
more memory efficient than the church-encoded `DList`.
- - - - -
8149c987 by Cheng Shao at 2025-12-20T17:06:51-05:00
hadrian: add with_profiled_libs flavour transformer
This patch adds a `with_profiled_libs` flavour transformer to hadrian
which is the exact opposite of `no_profiled_libs`. It adds profiling
ways to stage1+ rts/library ways, and doesn't alter other flavour
settings. It is useful when needing to test profiling logic locally
with a quick flavour.
- - - - -
746b18cd by Cheng Shao at 2025-12-20T17:06:51-05:00
hadrian: fix missing profiled dynamic libraries in profiled_ghc
This commit fixes the profiled_ghc flavour transformer to include
profiled dynamic libraries as well, since they're supported by GHC
since !12595.
- - - - -
4dd7e3b9 by Cheng Shao at 2025-12-20T17:07:33-05:00
ci: set http.postBuffer to mitigate perf notes timeout on some runners
This patch sets http.postBuffer to mitigate the timeout when fetching
perf notes on some runners with slow internet connection. Fixes #26684.
- - - - -
bc36268a by Wolfgang Jeltsch at 2025-12-21T16:23:24-05:00
Remove unused known keys and names for type representations
This removes the known-key and corresponding name variables for
`TrName`, `TrNameD`, `TypeRep`, `KindRepTypeLitD`, `TypeLitSort`, and
`mkTrType`, as they are apparently nowhere used in GHCās source code.
- - - - -
ff5050e9 by Wolfgang Jeltsch at 2025-12-21T16:24:04-05:00
Remove unused known keys and names for natural operations
This removes the known-key and corresponding name variables for
`naturalAndNot`, `naturalLog2`, `naturalLogBaseWord`, `naturalLogBase`,
`naturalPowMod`, `naturalSizeInBase`, `naturalToFloat`, and
`naturalToDouble`, as they are apparently nowhere used in GHCās source
code.
- - - - -
424388c2 by Wolfgang Jeltsch at 2025-12-21T16:24:45-05:00
Remove the unused known key and name for `Fingerprint`
This removes the variables for the known key and the name of the
`Fingerprint` data constructor, as they are apparently nowhere used in
GHCās source code.
- - - - -
a1ed86fe by Wolfgang Jeltsch at 2025-12-21T16:25:26-05:00
Remove the unused known key and name for `failIO`
This removes the variables for the known key and the name of the
`failIO` operation, as they are apparently nowhere used in GHCās source
code.
- - - - -
b8220daf by Wolfgang Jeltsch at 2025-12-21T16:26:07-05:00
Remove the unused known key and name for `liftM`
This removes the variables for the known key and the name of the `liftM`
operation, as they are apparently nowhere used in GHCās source code.
- - - - -
eb0628b1 by Wolfgang Jeltsch at 2025-12-21T16:26:47-05:00
Fix the documentation of `hIsClosed`
- - - - -
db1ce858 by sheaf at 2025-12-22T17:11:17-05:00
Do deep subsumption when computing valid hole fits
This commit makes a couple of improvements to the code that
computes "valid hole fits":
1. It uses deep subsumption for data constructors.
This matches up the multiplicities, as per
Note [Typechecking data constructors].
This fixes #26338 (test: LinearHoleFits).
2. It now suggests (non-unidirectional) pattern synonyms as valid
hole fits. This fixes #26339 (test: PatSynHoleFit).
3. It uses 'stableNameCmp', to make the hole fit output deterministic.
-------------------------
Metric Increase:
hard_hole_fits
-------------------------
- - - - -
72ee9100 by sheaf at 2025-12-22T17:11:17-05:00
Speed up hole fits with a quick pre-test
This speeds up the machinery for valid hole fits by doing a small
check to rule out obviously wrong hole fits, such as:
1. A hole fit identifier whose type has a different TyCon at the head,
after looking through foralls and (=>) arrows, e.g.:
hole_ty = Int
cand_ty = Maybe a
or
hole_ty = forall a b. a -> b
cand_ty = forall x y. Either x y
2. A hole fit identifier that is not polymorphic when the hole type
is polymorphic, e.g.
hole_ty = forall a. a -> a
cand_ty = Int -> Int
-------------------------
Metric Decrease:
hard_hole_fits
-------------------------
- - - - -
30e513ba by Cheng Shao at 2025-12-22T17:12:00-05:00
configure: remove unused win32-tarballs.md5sum
This patch removes the unused `win32-tarballs.md5sum` file from the
tree. The current mingw tarball download logic in
`mk/get-win32-tarballs.py` fetches and checks against `SHA256SUM` from
the same location where the tarballs are fetched, and this file has
been unused for a few years.
- - - - -
a2d52b3b by Wolfgang Jeltsch at 2025-12-23T04:47:33-05:00
Add an operation `System.IO.hGetNewlineMode`
This commit also contains some small code and documentation changes for
related operations, for the sake of consistency.
- - - - -
b26d134a by Cheng Shao at 2025-12-23T04:48:15-05:00
rts: opportunistically reclaim slop space in shrinkMutableByteArray#
Previously, `shrinkMutableByteArray#` shrinks a `MutableByteArray#`
in-place by assigning the new size to it, and zeroing the extra slop
space. That slop space is not reclaimed and wasted. But it's often the
case that we allocate a `MutableByteArray#` upfront, then shrink it
shortly after, so the `MutableByteArray#` closure sits right at the
end of a nursery block; this patch identifies such chances, and also
shrink `bd->free` if possible, reducing heap space fragmentation.
Co-authored-by: Codex <codex(a)openai.com>
-------------------------
Metric Decrease:
T10678
-------------------------
- - - - -
c72ddabf by Cheng Shao at 2025-12-23T16:13:23-05:00
hadrian: fix bootstrapping with ghc-9.14
This patch fixes bootstrapping GHC with ghc-9.14, tested locally with
ghc-9.14.1 release as bootstrapping GHC.
- - - - -
0fd6d8e4 by Cheng Shao at 2025-12-23T16:14:05-05:00
hadrian: pass -keep-tmp-files to test ghc when --keep-test-files is enabled
This patch makes hadrian pass `-keep-tmp-files` to test ghc when
`--keep-test-files` is enabled, so you can check the ghc intermediate
files when debugging certain test failures. Closes #26688.
- - - - -
81d10134 by Cheng Shao at 2025-12-24T06:11:52-05:00
configure: remove dead code in configure scripts
This patch removes dead code in our configure scripts, including:
- Variables and auto-detected programs that are not used
- autoconf functions that are not used, or export a variable that's
not used
- `AC_CHECK_HEADERS` invocations that don't have actual corresponding
`HAVE_XXX_H` usage
- Other dead code (e.g. stray `AC_DEFUN()`)
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
fb1381c3 by Wolfgang Jeltsch at 2025-12-24T06:12:34-05:00
Remove unused known keys and names for list operations
This removes the known-key and corresponding name variables for
`concat`, `filter`, `zip`, and `(++)`, as they are apparently nowhere
used in GHCās source code.
- - - - -
7b9c20f4 by Recursion Ninja at 2025-12-24T10:35:36-05:00
Decoupling Language.Haskell.Syntax.Binds from GHC.Types.Basic
by transferring InlinePragma types between the modules.
* Moved InlinePragma data-types to Language.Haskell.Syntax.Binds.InlinePragma
* Partitioned of Arity type synonyms to GHC.Types.Arity
* InlinePragma is now extensible via Trees That Grow
* Activation is now extensible via Trees That Grow
* Maybe Arity change to more descriptive InlineSaturation data-type
* InlineSaturation information removed from InlinePragma during GHS parsing pass
* Cleaned up the exposed module interfaces of the new modules
- - - - -
a3afae0c by Simon Peyton Jones at 2025-12-25T15:26:36-05:00
Check for rubbish literals in Lint
Addresses #26607.
See new Note [Checking for rubbish literals] in GHC.Core.Lint
- - - - -
8a317b6f by Aaron Allen at 2026-01-01T03:05:15-05:00
[#26183] Associated Type Iface Fix
When determining "extras" for class decl interface entries, axioms for
the associated types need to included so that dependent modules will be
recompiled if those axioms change.
resolves #26183
- - - - -
ae1aeaab by Cheng Shao at 2026-01-01T03:06:32-05:00
testsuite: run numeric tests with optasm when available
This patch adds the `optasm` extra way to nueric tests when NCG is
available. Some numeric bugs only surface with optimization, omitting
this can hide these bugs and even make them slip into release! (e.g. #26711)
- - - - -
6213bb57 by maralorn at 2026-01-02T16:30:32+01:00
GHC.Internal.Exception.Context: Fix comment
on addExceptionAnnotation
- - - - -
b820ff50 by Janis Voigtlaender at 2026-01-05T02:43:18-05:00
GHC.Internal.Control.Monad.replicateM: Fix comment
- - - - -
a8a94aad by Cheng Shao at 2026-01-05T16:24:04-05:00
hadrian: drops unused PE linker script for windows
This patch drops unused PE linker script for windows in the
`MergeObjects` builder of hadrian. The linker script is used for
merging object files into a single `HS*.o` object file and undoing the
effect of split sections, when building the "ghci library" object
file. However, we don't build the ghci library on windows, and this
code path is actually unreachable.
- - - - -
53038ea9 by Cheng Shao at 2026-01-05T16:24:04-05:00
hadrian: drop unused logic for building ghci libraries
This patch drops the unused logic for building ghci libraries in
hadrian:
- The term "ghci library" refers to an optional object file per
library `HS*.o`, which is merged from multiple object files in that
library using the `MergeObjects` builder in hadrian.
- The original rationale of having a ghci library object, in addition
to normal archives, was to speedup ghci loading, since the combined
object is linked with a linker script to undo the effects of
`-fsplit-sections` to reduce section count and make it easier for
the RTS linker to handle.
- However, most GHC builds enable `dynamicGhcPrograms` by default, in
such cases the ghci library would already not be built.
- `dynamicGhcPrograms` is disabled on Windows, but still we don't
build the ghci library due to lack of functioning merge objects
command.
- The only case that we actually build ghci library objects, are
alpine fully static bindists. However, for other reasons, split
sections is already disabled for fully static builds anyway!
- There will not be any regression if the ghci library objects are
absent from a GHC global libdir when `dynamicGhcPrograms` is
disabled. The RTS linker can already load the archives without any
issue.
Hence the removal. We now forcibly disable ghci libraries for all
Cabal components, and rip out all logic related to `MergeObjects` and
ghci libraries in hadrian. This also nicely cleans up some old todos
and fixmes that are no longer relevant.
Note that MergeObjects in hadrian is not the same thing as merge
objects in the GHC driver. The latter is not affected by this patch.
-------------------------
Metric Decrease:
libdir
-------------------------
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
8f209336 by Simon Jakobi at 2026-01-05T16:24:48-05:00
User's guide: Fix link to language extensions
Instead of linking to haddocks, it seemed more useful to link
to the extension overview in the user's guide.
Closes #26614.
- - - - -
0b7df6db by Simon Peyton Jones at 2026-01-06T09:32:23-05:00
Improved fundeps for closed type families
The big payload of this commit is to execute the plan suggested
in #23162, by improving the way that we generate functional
dependencies for closed type families.
It is all described in Note [Exploiting closed type families]
Most of the changes are in GHC.Tc.Solver.FunDeps
Other small changes
* GHC.Tc.Solver.bumpReductionDepth. This function brings together the code that
* Bumps the depth
* Checks for overflow
Previously the two were separated, sometimes quite widely.
* GHC.Core.Unify.niFixSubst: minor improvement, removing an unnecessary
itraetion in the base case.
* GHC.Core.Unify: no need to pass an InScopeSet to
tcUnifyTysForInjectivity. It can calculate one for itself; and it is
never inspected anyway so it's free to do so.
* GHC.Tc.Errors.Ppr: slight impovement to the error message for
reduction-stack overflow, when a constraint (rather than a type) is
involved.
* GHC.Tc.Solver.Monad.wrapUnifier: small change to the API
- - - - -
fde8bd88 by Simon Peyton Jones at 2026-01-06T09:32:23-05:00
Add missing (KK4) to kick-out criteria
There was a missing case in kick-out that meant we could fail
to solve an eminently-solvable constraint.
See the new notes about (KK4)
- - - - -
00082844 by Simon Peyton Jones at 2026-01-06T09:32:23-05:00
Some small refactorings of error reporting in the typechecker
This is just a tidy-up commit.
* Add ei_insoluble to ErrorItem, to cache insolubility.
Small tidy-up.
* Remove `is_ip` and `mkIPErr` from GHC.Tc.Errors; instead enhance mkDictErr
to handle implicit parameters. Small refactor.
- - - - -
fe4cb252 by Simon Peyton Jones at 2026-01-06T09:32:24-05:00
Improve recording of insolubility for fundeps
This commit addresses #22652, by recording when the fundeps for
a constraint are definitely insoluble. That in turn improves the
perspicacity of the pattern-match overlap checker.
See Note [Insoluble fundeps]
- - - - -
df0ffaa5 by Simon Peyton Jones at 2026-01-06T09:32:24-05:00
Fix a buglet in niFixSubst
The MR of which this is part failed an assertion check extendTvSubst
because we extended the TvSubst with a CoVar. Boo.
This tiny patch fixes it, and adds the regression test from #13882
that showed it up.
- - - - -
3d6aba77 by konsumlamm at 2026-01-06T09:33:16-05:00
Fix changelog formatting
- - - - -
69e0ab59 by Cheng Shao at 2026-01-06T19:37:56-05:00
compiler: add targetHasRTSWays function
This commit adds a `targetHasRTSWays` util function in
`GHC.Driver.Session` to query if the target RTS has a given Ways (e.g.
WayThreaded).
- - - - -
25a0ab94 by Cheng Shao at 2026-01-06T19:37:56-05:00
compiler: link on-demand external interpreter with threaded RTS
This commit makes the compiler link the on-demand external interpreter
program with threaded RTS if it is available in the target RTS ways.
This is a better default than the previous single-threaded RTS, and it
enables the external interpreter to benefit from parallelism when
deserializing CreateBCOs messages.
- - - - -
92404a2b by Cheng Shao at 2026-01-06T19:37:56-05:00
hadrian: link iserv with threaded RTS
This commit makes hadrian link iserv with threaded RTS if it's
available in the RTS ways. Also cleans up the iserv main C program
which can be replaced by the `-fkeep-cafs` link-time option.
- - - - -
a20542d2 by Cheng Shao at 2026-01-06T19:38:38-05:00
ghc-internal: remove unused GMP macros
This patch removes unused GMP related macros from `ghc-internal`. The
in-tree GMP version was hard coded and outdated, but it was not used
anywhere anyway.
- - - - -
4079dcd6 by Cheng Shao at 2026-01-06T19:38:38-05:00
hadrian: fix in-tree gmp configure error on newer c compilers
Building in-tree gmp on newer c compilers that default to c23 fails at
configure stage, this patch fixes it, see added comment for
explanation.
- - - - -
414d1fe1 by Cheng Shao at 2026-01-06T19:39:20-05:00
compiler: fix LLVM backend pdep/pext handling for i386 target
This patch fixes LLVM backend's pdep/pext handling for i386 target,
and also removes non-existent 128/256/512 bit hs_pdep/hs_pext callees.
See amended note for more explanation. Fixes #26450.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
c7f6fba3 by Cheng Shao at 2026-01-06T19:39:20-05:00
ci: remove allow_failure flag for i386 alpine job
The LLVM codegen issue for i386 has been fixed, and the i386 alpine
job should pass now. This commit removes the allow_failure flag so
that other i386 regressions in the future are signaled more timely.
- - - - -
52d00c05 by Simon Peyton Jones at 2026-01-07T10:24:21-05:00
Add missing InVar->OutVar lookup in SetLevels
As #26681 showed, the SetLevels pass was failing to map an InVar to
an OutVar. Very silly! I'm amazed it hasn't broken before now.
I have improved the type singatures (to mention InVar and OutVar)
so it's more obvious what needs to happen.
- - - - -
ab0a5594 by Cheng Shao at 2026-01-07T10:25:04-05:00
hadrian: drop deprecated pkgHashSplitObjs code path
This patch drops deprecated `pkgHashSplitObjs` code path from hadrian,
since GHC itself has removed split objs support many versions ago and
this code path is unused.
- - - - -
bb3a2ba1 by Cheng Shao at 2026-01-07T10:25:44-05:00
hadrian: remove linting/assertion in quick-validate flavour
The `quick-validate` flavour is meant for testing ghc and passing the
testsuite locally with similar settings to `validate` but faster. This
patch removes the linting/assertion overhead in `quick-validate` to
improve developer experience. I also took the chance to simplify
redundant logic of rts/library way definition in `validate` flavour.
- - - - -
7971f5dd by Cheng Shao at 2026-01-07T10:26:26-05:00
deriveConstants: clean up unused constants
This patch cleans up unused constants from `deriveConstants`, they are
not used by C/Cmm code in the RTS, nor compiler-generated code.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
4df96993 by Cheng Shao at 2026-01-07T10:27:08-05:00
hadrian: pass -fno-omit-frame-pointer with +debug_info
This patch adds `-fno-omit-frame-pointer` as C/C++ compilation flag
when compiling with `+debug_info` flavour transformer. It's a sane
default when you care about debugging and reliable backtraces, and
makes debugging/profiling with bpf easier.
- - - - -
8a3900a3 by Aaron Allen at 2026-01-07T10:27:57-05:00
[26705] Include TyCl instances in data fam iface entry
Ensures dependent modules are recompiled when the class instances for a
data family instance change.
resolves #26705
- - - - -
a0b980af by Cheng Shao at 2026-01-07T10:28:38-05:00
hadrian: remove unused Hp2Ps/Hpc builders
This patch removes the Hp2Ps/Hpc builders from hadrian, they are
unused in the build system. Note that the hp2ps/hpc programs are still
built and not affected.
- - - - -
50a58757 by Cheng Shao at 2026-01-07T10:29:20-05:00
hadrian: only install js files to libdir for wasm/js targets
There are certain js files required for wasm/js targets to work, and
previously hadrian would install those js files to libdir
unconditionally on other targets as well. This could be a minor
annoyance for packagers especially when the unused js files contain
shebangs that interfere with the packaging process. This patch makes
hadrian only selectively install the right js files for the right
targets.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
da40e553 by Simon Peyton Jones at 2026-01-07T10:30:00-05:00
Add flavour transformer assertions_stage1
This allows us to enable -DDEBUG assertions in the stage1 compiler
- - - - -
ec3cf767 by Cheng Shao at 2026-01-08T06:24:31-05:00
make: remove unused Makefiles from legacy make build system
This patch removes unused Makefiles from legacy make build system; now
they are never used by hadrian in any way, and they already include
common boilerplate mk files that are long gone in the make build
system removal, hence the housecleaning.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
04ea3f83 by Cheng Shao at 2026-01-08T06:25:13-05:00
compiler: use -O3 as LLVM optimization level for ghc -O2
The GHC driver clamps LLVM optimization level to `-O2` due to LLVM
crashes, but those were historical issues many years ago that are no
longer relevant for LLVM versions we support today. This patch changes
the driver to use `-O3` as LLVM optimization level when compiling with
`-O2`, which is a better default when we're willing to trade
compilation time for faster generated code.
- - - - -
472df471 by Peter Trommler at 2026-01-08T13:28:54-05:00
Use half-word literals in info tables
With this commit info tables are mapped to the same assembler code
on big-endian and little-endian platforms.
Fixes #26579.
- - - - -
393f9c51 by Simon Peyton Jones at 2026-01-08T13:29:35-05:00
Refactor srutOkForBinderSwap
This MR does a small refactor:
* Moves `scrutOkForBinderSwap` and `BinderSwapDecision`
to GHC.Core.Utils
* Inverts the sense of the coercion it returns, which makes
more sense
No effect on behaviour
- - - - -
ad76fb0f by Simon Peyton Jones at 2026-01-08T13:29:36-05:00
Improve case merging
This small MR makes case merging happen a bit more often than
it otherwise could, by getting join points out of the way.
See #26709 and GHC.Core.Utils
Note [Floating join points out of DEFAULT alternatives]
- - - - -
4c9395f5 by Cheng Shao at 2026-01-08T13:30:16-05:00
hadrian: remove broken hsc2hs flag when cross compiling to windows
This patch removes the `--via-asm` hsc2hs flag when cross compiling to
windows. With recent llvm-mingw toolchain, it would fail with:
```
x86_64-w64-mingw32-hsc2hs: Cannot combine instructions: [Quad 8,Long 4,Long 241,Ref ".Ltmp1-.Ltmp0"]
```
The hsc2hs default `--cross-compile` logic is slower but works.
- - - - -
71fdef55 by Simon Peyton Jones at 2026-01-08T13:30:57-05:00
Try harder to keep the substitution empty
Avoid unnecessary cloning of variables in the Simplifier.
Addresses #26724,
See Note [Keeping the substitution empty]
We get some big wins in compile time
Metrics: compile_time/bytes allocated
-------------------------------------
Baseline
Test Metric value New value Change
----------------------------------------------------------------------------
CoOpt_Singletons(normal) ghc/alloc 721,544,088 692,174,216 -4.1% GOOD
LargeRecord(normal) ghc/alloc 1,268,031,157 1,265,168,448 -0.2%
T14766(normal) ghc/alloc 918,218,533 688,432,296 -25.0% GOOD
T15703(normal) ghc/alloc 318,103,629 306,638,016 -3.6% GOOD
T17836(normal) ghc/alloc 419,174,584 418,400,824 -0.2%
T18478(normal) ghc/alloc 471,042,976 470,261,376 -0.2%
T20261(normal) ghc/alloc 573,387,162 563,663,336 -1.7%
T24984(normal) ghc/alloc 87,832,666 87,636,168 -0.2%
T25196(optasm) ghc/alloc 1,103,284,040 1,101,376,992 -0.2%
hard_hole_fits(normal) ghc/alloc 224,981,413 224,608,208 -0.2%
geo. mean -0.3%
minimum -25.0%
maximum +0.1%
Metric Decrease:
CoOpt_Singletons
T14766
T15703
- - - - -
30341168 by Simon Peyton Jones at 2026-01-08T13:31:38-05:00
Add regression test for #24867
- - - - -
1ac1a541 by Julian Ospald at 2026-01-09T02:48:53-05:00
Support statically linking executables properly
Fixes #26434
In detail, this does a number of things:
* Makes GHC aware of 'extra-libraries-static' (this changes the package
database format).
* Adds a switch '-static-external' that will honour 'extra-libraries-static'
to link external system dependencies statically.
* Adds a new field to settings/targets: "ld supports verbatim namespace".
This field is used by '-static-external' to conditionally use '-l:foo.a'
syntax during linking, which is more robust than trying to find the
absolute path to an archive on our own.
* Adds a switch '-fully-static' that is meant as a high-level interface
for e.g. cabal. This also honours 'extra-libraries-static'.
This also attempts to clean up the confusion around library search directories.
At the moment, we have 3 types of directories in the package database
format:
* library-dirs
* library-dirs-static
* dynamic-library-dirs
However, we only have two types of linking: dynamic or static. Given the
existing logic in 'mungeDynLibFields', this patch assumes that
'library-dirs' is really just nothing but a fallback and always
prefers the more specific variants if they exist and are non-empty.
Conceptually, we should be ok with even just one search dirs variant.
Haskell libraries are named differently depending on whether they're
static or dynamic, so GHC can conveniently pick the right one depending
on the linking needs. That means we don't really need to play tricks
with search paths to convince the compiler to do linking as we want it.
For system C libraries, the convention has been anyway to place static and
dynamic libs next to each other, so we need to deal with that issue
anyway and it is outside of our control. But this is out of the scope
of this patch.
This patch is backwards compatible with cabal. Cabal should however
be patched to use the new '-fully-static' switch.
- - - - -
ad3c808d by Julian Ospald at 2026-01-09T02:48:53-05:00
Warn when "-dynamic" is mixed with "-staticlib"
- - - - -
322dd672 by Matthew Pickering at 2026-01-09T02:49:35-05:00
rts: Use INFO_TABLE_CONSTR for stg_dummy_ret_closure
Since the closure type is CONSTR_NOCAF, we need to use INFO_TABLE_CONSTR
to populate the constructor description field (this crashes ghc-debug
when decoding AP_STACK frames sometimes)
Fixes #26745
- - - - -
039bac4c by Ben Gamari at 2026-01-09T20:22:16-05:00
ghc-internal: Move STM utilities out of GHC.Internal.Conc.Sync
This is necessary to avoid an import cycle on Windows when importing
`GHC.Internal.Exception.Context` in `GHC.Internal.Conc.Sync`.
On the road to address #25365.
- - - - -
8c389e8c by Ben Gamari at 2026-01-09T20:22:16-05:00
base: Capture backtrace from throwSTM
Implements core-libraries-committee#297.
Fixes #25365.
- - - - -
e1ce1fc3 by Ben Gamari at 2026-01-09T20:22:16-05:00
base: Annotate rethrown exceptions in catchSTM with WhileHandling
Implements core-libraries-committee#298
- - - - -
c4ebdbdf by Cheng Shao at 2026-01-09T20:23:06-05:00
compiler: make getPrim eagerly evaluate its result
This commit makes `GHC.Utils.Binary.getPrim` eagerly evaluate its
result, to avoid accidental laziness when future patches build other
binary parsers using `getPrim`.
- - - - -
66a0c4f7 by Cheng Shao at 2026-01-09T20:23:06-05:00
compiler: implement fast get/put for Word16/Word32/Word64
Previously, `GHC.Utils.Binary` contains `get`/`put` functions for
`Word16`/`Word32`/`Word64` which always loads and stores them as
big-endian words at a potentially unaligned address. The previous
implementation is based on loads/stores of individual bytes and
concatenating bytes with bitwise operations, which currently cannot be
fused to a single load/store operation by GHC.
This patch implements fast `get`/`put` functions for
`Word16`/`Word32`/`Word64` based on a single memory load/store, with
an additional `byteSwap` operation on little-endian hosts. It is based
on unaligned load/store primops added since GHC 9.10, and we already
require booting with at least 9.10, so it's about time to switch to
this faster path.
- - - - -
641ec3f0 by Simon Peyton Jones at 2026-01-09T20:23:55-05:00
Fix scoping errors in specialisation
Using -fspecialise-aggressively in #26682 showed up a couple of
subtle errors in the type-class specialiser.
* dumpBindUDs failed to call `deleteCallsMentioning`, resulting in a
call that mentioned a dictionary that was not in scope. This call
has been missing since 2009!
commit c43c981705ec33da92a9ce91eb90f2ecf00be9fe
Author: Simon Peyton Jones <simonpj(a)microsoft.com>
Date: Fri Oct 23 16:15:51 2009 +0000
Fixed by re-combining `dumpBindUDs` and `dumpUDs`.
* I think there was another bug involving the quantified type
variables in polymorphic specialisation. In any case I refactored
`specHeader` and `spec_call` so that the former looks for the
extra quantified type variables rather than the latter. This
is quite a worthwhile simplification: less code, easier to grok.
Test case in simplCore/should_compile/T26682,
brilliantly minimised by @sheaf.
- - - - -
2433e91d by Cheng Shao at 2026-01-09T20:24:43-05:00
compiler: change sectionProtection to take SectionType argument
This commit changes `sectionProtection` to only take `SectionType`
argument instead of whole `Section`, since it doesn't need the Cmm
section content anyway, and it can then be called in parts of NCG
where we only have a `SectionType` in scope.
- - - - -
e5926fbe by Cheng Shao at 2026-01-09T20:24:43-05:00
compiler: change isInitOrFiniSection to take SectionType argument
This commit changes `isInitOrFiniSection` to only take `SectionType`
argument instead of whole `Section`, since it doesn't need the Cmm
section content anyway, and it can then be called in parts of NCG
where we only have a `SectionType` in scope. Also marks it as
exported.
- - - - -
244d57d7 by Cheng Shao at 2026-01-09T20:24:43-05:00
compiler: fix split sections on windows
This patch fixes split sections on windows by emitting the right
COMDAT section header in NCG, see added comment for more explanation.
Fix #26696 #26494.
-------------------------
Metric Decrease:
LargeRecord
T9675
size_hello_artifact
size_hello_artifact_gzip
size_hello_unicode
size_hello_unicode_gzip
Metric Increase:
T13035
-------------------------
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
182f3d0f by Cheng Shao at 2026-01-09T20:25:28-05:00
iserv: add comment about -fkeep-cafs
- - - - -
49675b69 by Matthew Craven at 2026-01-09T20:26:14-05:00
Account for "stupid theta" in demand sig for DataCon wrappers
Fixes #26748.
- - - - -
f3c18890 by Samuel Thibault at 2026-01-10T15:48:22+01:00
hurd: Fix getExecutablePath build
3939a8bf93e27 ("GNU/Hurd: Add getExecutablePath support") added using
/proc/self/exe for GNU/Hurd but missed adding the required imports for
the corresponding code.
- - - - -
7f15bd15 by Samuel Thibault at 2026-01-12T07:16:25-05:00
Fix the OS string encoding for GNU/Hurd
Following https://github.com/haskell/cabal/pull/9434/files , and as seen
in the various gnu_HOST_OS usages in the source code, it is expected that
GNU/Hurd is advertised as "gnu", like the autotools do.
- - - - -
1db2f240 by Andrew Lelechenko at 2026-01-12T07:17:06-05:00
Add since annotation for Data.Bifoldable1
Fixes #26432
- - - - -
e038a383 by Sven Tennie at 2026-01-12T07:17:49-05:00
Ignore Windows CI tool directories in Git
Otherwise, we see thousands of changes in `git status` which is very
confusing to work with.
- - - - -
023c301c by sheaf at 2026-01-13T04:57:30-05:00
Don't re-use stack slots for growing registers
This commit avoids re-using a stack slot for a register that has grown
but already had a stack slot.
For example, suppose we have stack slot assigments
%v1 :: FF64 |-> StackSlot 0
%v2 :: FF64 |-> StackSlot 1
Later, we start using %v1 at a larger format (e.g. F64x2) and we need
to spill it again. Then we **must not** use StackSlot 0, as a spill
at format F64x2 would clobber the data in StackSlot 1.
This can cause some fragmentation of the `StackMap`, but that's probably
OK.
Fixes #26668
- - - - -
d0966e64 by fendor at 2026-01-13T04:58:11-05:00
Remove `traceId` from ghc-pkg executable
- - - - -
20d7efec by Simon Peyton Jones at 2026-01-13T12:41:22-05:00
Make SpecContr rules fire a bit later
See #26615 and Note [SpecConstr rule activation]
- - - - -
8bc4eb8c by Andrew Lelechenko at 2026-01-13T12:42:03-05:00
Upgrade mtl submodule to 2.3.2
Fixes #26656
- - - - -
c94aaacd by Cheng Shao at 2026-01-13T12:42:44-05:00
compiler: remove iserv and only use on-demand external interpreter
This patch removes `iserv` from the tree completely. Hadrian would no
longer build or distribute `iserv`, and the GHC driver would use the
on-demand external interpreter by default when invoked with
`-fexternal-interpreter`, without needing to specify `-pgmi ""`. This
has multiple benefits:
- It allows cleanup of a lot of legacy hacks in the hadrian codebase.
- It paves the way for running cross ghc's iserv via cross emulator
(#25523), fixing TH/ghci support for cross targets other than
wasm/js.
- - - - -
c1fe0097 by Peter Trommler at 2026-01-14T03:54:49-05:00
PPC NCG: Fix shift right MO code
The shift amount in shift right [arithmetic] MOs is machine word
width. Therefore remove unnecessary zero- or sign-extending of
shift amount.
It looks harmless to extend the shift amount argument because the
shift right instruction uses only the seven lowest bits (i. e. mod 128).
But now we have a conversion operation from a smaller type to word width
around a memory load at word width. The types are not matching up but
there is no check done in CodeGen. The necessary conversion from word
width down to the smaller width would be translated into a no-op on
PowerPC anyway. So all seems harmless if it was not for a small
optimisation in getRegister'.
In getRegister' a load instruction with the smaller width of the
conversion operation was generated. This loaded the most significant
bits of the word in memory on a big-endian platform. These bits were
zero and hence shift right was used with shift amount zero and not one
as required in test Sized.
Fixes #26519
- - - - -
2dafc65a by Cheng Shao at 2026-01-14T03:55:31-05:00
Tree-wide cleanup of cygwin logic
GHC has not supported cygwin for quite a few years already, and will
not resume support in the forseeable future. The only supported
windows toolchain is clang64/clangarm64 of the msys2 project. This
patch cleans up the unused cygwin logic in the tree.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
66b96e2a by Teo Camarasu at 2026-01-14T03:56:13-05:00
Set default eventlog-flush-interval to 5s
Resolves #26707
- - - - -
d0254579 by Andrew Lelechenko at 2026-01-14T03:56:53-05:00
Document when -maxN RTS option was added
- - - - -
f25e2b12 by Cheng Shao at 2026-01-14T11:10:39-05:00
testsuite: remove obsolete --ci option from the testsuite driver
This patch removes the obsolete `--ci` option from the testsuite
driver: neither the CI scripts nor hadrian ever invokes the testsuite
driver with `--ci`, and the perf notes are always fetched to the
`refs/notes/perf` local reference anyway.
- - - - -
7964763b by Julian Ospald at 2026-01-14T11:11:31-05:00
Fix fetch_cabal
* download cabal if the existing one is of an older version
* fix FreeBSD download url
* fix unpacking on FreeBSD
- - - - -
6b0129c1 by Julian Ospald at 2026-01-14T11:11:31-05:00
Bump toolchain in CI
- - - - -
0f53ccc6 by Julian Ospald at 2026-01-14T11:11:31-05:00
Use libffi-clib
Previously, we would build libffi via hadrian
and bundle it manually with the GHC bindist.
This now moves all that logic out of hadrian
and allows us to have a clean Haskell package
to build and link against and ship it without
extra logic.
This patch still retains the ability to link
against a system libffi.
The main reason of bundling libffi was that on
some platforms (e.g. FreeBSD and Mac), system libffi
is not visible to the C toolchain by default,
so users would require settings in e.g. cabal
to be able to compile anything.
This adds the submodule libffi-clib to the repository.
- - - - -
5e1cd595 by Peng Fan at 2026-01-14T11:12:26-05:00
NCG/LA64: add support for la664 micro architecture
Add '-mla664' flag to LA664, which has some new features:
atomic instructions, dbar hints, etc.
'LA464' is the default so that unrecognized instructions are not
generated.
- - - - -
c56567ec by Simon Peyton Jones at 2026-01-15T23:19:04+00:00
Add evals for strict data-con args in worker-functions
This fixes #26722, by adding an eval in a worker for
arguments of strict data constructors, even if the
function body uses them strictly.
See (WIS1) in Note [Which Ids should be strictified]
I took the opportunity to make substantial improvements in the
documentation for call-by-value functions. See especially
Note [CBV Function Ids: overview] in GHC.Types.Id.Info
Note [Which Ids should be CBV candidates?] ditto
Note [EPT enforcement] in GHC.Stg.EnforceEpt
among others.
- - - - -
9719ce5d by Simon Peyton Jones at 2026-01-15T23:19:04+00:00
Improve `interestingArg`
This function analyses a function's argument to see if it is
interesting enough to deserve an inlining discount. Improvements
for
* LitRubbish arguments
* exprIsExpandable arguments
See Note [Interesting arguments] which is substantially rewritten.
- - - - -
7b616b9f by Cheng Shao at 2026-01-16T06:45:00-05:00
compiler: fix regression when compiling foreign stubs in the rts unit
This patch fixes a regression when compiling foreign stubs in the rts
unit introduced in 05e25647f72bc102061af3f20478aa72bff6ff6e. A simple
revert would fix it, but it's better to implement a proper fix with
comment for better understanding of the underlying problem, see the
added comment for explanation.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
c343ef64 by Sylvain Henry at 2026-01-16T06:45:51-05:00
base: remove GHC.JS.Prim.Internal.Build (#23432)
See accepted CLC proposal https://github.com/haskell/core-libraries-committee/issues/329
- - - - -
29c0aceb by Simon Peyton Jones at 2026-01-16T17:18:11-05:00
Improve newtype unwrapping
Ticket #26746 describes several relatively-minor shortcomings of newtype
unwrapping. This MR addresses them, while also (arguably) simplifying
the code a bit.
See new Note [Solving newtype equalities: overview]
and Note [Decomposing newtype equalities]
and Note [Eager newtype decomposition]
and Note [Even more eager newtype decomposition]
For some reason, on Windows only, runtime allocations decrease for test
T5205 (from 52k to 48k). I have not idea why. No change at all on Linux.
I'm just going to accept the change. (I saw this same effect in another
MR so I think it's a fault in the baseline.)
Metric Decrease:
T5205
- - - - -
8b59e62c by Andreas Klebinger at 2026-01-16T17:18:52-05:00
testsuite: Widen acceptance window for T5205.
Fixes #26782
- - - - -
9e5e0234 by mangoiv at 2026-01-17T06:03:03-05:00
add a new issue template for getting verified
To reduce spam created by new users, we will in future not grant
any rights but reporting issues to new users. That is why we will
have to be able to verify them. The added issue template serves that
purpose.
- - - - -
b18b2c42 by Cheng Shao at 2026-01-17T06:03:44-05:00
llvm: fix split sections for llvm backend
This patch fixes split sections for llvm backend:
- Pass missing `--data-sections`/`--function-sections` flags to
llc/opt.
- Use `(a)llvm.compiler.used` instead of `(a)llvm.used` to avoid sections
being unnecessarily retained at link-time.
Fixes #26770.
-------------------------
Metric Decrease:
libdir
size_hello_artifact
size_hello_unicode
-------------------------
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
ebf66f67 by Cheng Shao at 2026-01-17T13:16:50-05:00
Update autoconf scripts
Scripts taken from autoconf a2287c3041a3f2a204eb942e09c015eab00dc7dd
- - - - -
598624b9 by Andreas Klebinger at 2026-01-17T13:17:32-05:00
CString.hs: Update incorrect comment.
Fixes #26322
- - - - -
eea2036b by Cheng Shao at 2026-01-18T10:00:49-05:00
libraries: bump haskeline submodule to 0.8.4.1
This patch bumps the haskeline submodule to 0.8.4.1 which includes an
important fix for an ANSI handling bug on Windows
(https://github.com/haskell/haskeline/pull/126)
- - - - -
87d8f6c2 by Cheng Shao at 2026-01-18T10:01:30-05:00
hadrian: replace default -H32m/-H64m with -O64M to improve mutator productivity
Most hadrian build flavours pass `-H32m`/`-H64m` to GHC as
conventional wisdom to improve mutator productivity and reduce GC
overhead. They were inherited from the legacy Make build system, and
there used to be make flags to instrument a build process with
`-Rghc-timing` option to collect GC stats of each GHC run from stderr.
It's time to revisit whether there are better defaults for
`-H32m`/`-H64m`, and this patch changes it to `-O64M` which indeed
improves mutator productivity based on real statistics. `-O64M` is
more aggressive than `-H64m`; it allows the old generation to grow to
at least 64M before triggering major GC and reduces major GC runs.
The stats of a clean build with `validate` flavour and `-H64m`:
```
h64m.log
matched RTS stat lines: 5499
sum MUT cpu : 2400.808 s
sum GC cpu : 1378.292 s
sum MUT elapsed : 2788.253 s
sum GC elapsed : 1389.233 s
GC/MUT cpu ratio : 0.574 (GC is 57.4% of MUT)
GC/MUT elapsed ratio : 0.498 (GC is 49.8% of MUT)
GC fraction of (MUT+GC) cpu : 36.5%
GC fraction of (MUT+GC) elapsed : 33.3%
per-line GC/MUT cpu ratio: median 0.691, p90 1.777
per-line GC/MUT elapsed ratio: median 0.519, p90 1.081
```
The stats of a clean build with `validate` flavour and `-O64M`:
```
o64m.log
matched RTS stat lines: 5499
sum MUT cpu : 2377.383 s
sum GC cpu : 1127.146 s
sum MUT elapsed : 2758.857 s
sum GC elapsed : 1135.587 s
GC/MUT cpu ratio : 0.474 (GC is 47.4% of MUT)
GC/MUT elapsed ratio : 0.412 (GC is 41.2% of MUT)
GC fraction of (MUT+GC) cpu : 32.2%
GC fraction of (MUT+GC) elapsed : 29.2%
per-line GC/MUT cpu ratio: median 0.489, p90 1.099
per-line GC/MUT elapsed ratio: median 0.367, p90 0.806
```
Mutator time is roughly in the same ballpark, but GC CPU time has
reduced by 18.22%, and mutator productivity has increased from 63.5%
to 67.8%.
- - - - -
8372e13d by Cheng Shao at 2026-01-18T10:02:12-05:00
rts: remove unused .def files from rts/win32
This patch removes unused .def files from `rts/win32`, given we don't
build .dll files for rts/ghc-internal/ghc-prim at all. Even when we
resurrect win32 dll support at some point in the future, these .def
files still contain incorrect symbols anyway and won't be of any use.
- - - - -
f6af485d by Cheng Shao at 2026-01-18T10:03:19-05:00
.gitmodules: use gitlab mirror for the libffi-clib submodule
This patch fixes .gitmodules to use the gitlab mirror for the
libffi-clib submodule, to make it coherent with other submodules that
allow ghc developers to experiment with wip branches in submodules for
ghc patches. Fixes #26783.
- - - - -
41432d25 by Cheng Shao at 2026-01-18T10:05:13-05:00
hadrian: remove the horrible i386 speedHack
When hadrian builds certain rts objects for i386, there's a horrible
speedHack that forces -fno-PIC even for dynamic ways of those objects.
This is not compatible with newer versions of gcc/binutils as well as
clang/lld, and this patch removes it. Fixes #26792.
- - - - -
323eb8f0 by Cheng Shao at 2026-01-18T21:48:19-05:00
hadrian: enable split sections for cross stage0
This patch fixes a minor issue with `splitSectionsArgs` in hadrian:
previously, it's unconditionally disabled for stage0 libraries because
it's not going to be shipped in the final bindists. But it's only true
when not cross compiling. So for now we also need to enable it for
cross stage0 as well.
- - - - -
3fadfefe by Andreas Klebinger at 2026-01-18T21:49:01-05:00
RTS: Document -K behaviour better
- - - - -
30f442a9 by Teo Camarasu at 2026-01-20T13:57:26-05:00
base: don't expose GHC.Num.{BigNat, Integer, Natural}
We no longer expose GHC.Num.{BigNat, Integer, Natural} from base instead users should get these modules from ghc-bignum.
We make this change to insulate end users from changes to GHC's implementation of big numbers.
Implements CLC proposal 359: https://github.com/haskell/core-libraries-committee/issues/359
- - - - -
75a9053d by Teo Camarasu at 2026-01-20T13:58:07-05:00
base: deprecate GHC internals in GHC.Num
Implements CLC proposal: https://github.com/haskell/core-libraries-committee/issues/360
- - - - -
9534b032 by Andreas Klebinger at 2026-01-20T13:58:50-05:00
ghc-experimental: Update Changelog
I tried to reconstruct a high level overview of the changes and when
they were made since we introduced it.
Fixes #26506
Co-authored-by: Teo Camarasu <teofilcamarasu(a)gmail.com>
- - - - -
346f2f5a by Cheng Shao at 2026-01-20T13:59:30-05:00
hadrian: remove RTS options in ghc-in-ghci flavour
This patch removes the RTS options passed to ghc in ghc-in-ghci
flavour, to workaround command line argument handling issue in
hls/hie-boot that results in `-O64M` instead of `+RTS -O64M -RTS`
being passed to ghc. It's not a hadrian bug per se, since ghc's own
ghc-in-ghci multi repl works fine, but we should still make sure HLS
works. Closes #26801.
- - - - -
759fd15a by Andreas Klebinger at 2026-01-21T16:05:28-05:00
Don't build GHC with -Wcompat
Without bumping the boot compiler the warnings it produces are often not
actionable leading to pointless noise.
Fixes #26800
- - - - -
3172db94 by Torsten Schmits at 2026-01-21T16:06:11-05:00
Use the correct field of ModOrigin when formatting error message listing hidden reexports
- - - - -
485c12b2 by Cheng Shao at 2026-01-21T16:06:54-05:00
Revert "hadrian: handle findExecutable "" gracefully"
This reverts commit 1e5752f64a522c4025365856d92f78073a7b3bba. The
underlying issue has been fixed in
https://github.com/haskell/directory/commit/75828696e7145adc09179111a0d631bā¦
and present since 1.3.9.0, and hadrian directory lower bound is
1.3.9.0, so we can revert our own in house hack now.
- - - - -
5efb58dc by Cheng Shao at 2026-01-21T16:07:36-05:00
rts: fix typo in TICK_ALLOC_RTS
This patch fixes a typo in the `TICK_ALLOC_RTS` macro, the original
`bytes` argument was silently dropped. The Cmm code has its own
version of `TICK_ALLOC_RTS` not affected by this typo, it affected the
C RTS, and went unnoticed because the variable `n` happened to also be
available at its call site. But the number was incorrect. Also fixes
its call site since `WDS()` is not available in C.
- - - - -
c406ea69 by Cheng Shao at 2026-01-21T16:07:36-05:00
rts: remove broken & unused ALLOC_P_TICKY
This patch removes the `ALLOC_P_TICKY` macro from the rts, it's
unused, and its expanded code is already broken.
- - - - -
34a27e20 by Simon Peyton Jones at 2026-01-21T16:08:17-05:00
Make the implicit-parameter class have representational role
This MR addresses #26737, by making the built-in class IP
have a representational role for its second parameter.
See Note [IP: implicit parameter class] in
ghc-internal:GHC.Internal.Classes.IP
In fact, IP is (unfortunately, currently) exposed by
base:GHC.Base, so we ran a quick CLC proposal to
agree the change:
https://github.com/haskell/core-libraries-committee/issues/385
Some (small) compilations get faster because they only need to
load (small) interface file GHC.Internal.Classes.IP.hi,
rather than (large) GHC.Internal.Classes.hi.
Metric Decrease:
T10421
T12150
T12425
T24582
T5837
T5030
- - - - -
ca79475f by Cheng Shao at 2026-01-21T16:09:00-05:00
testsuite: avoid re.sub in favor of simple string replacements
This patch refactors the testsuite driver and avoids the usage of
re.sub in favor of simple string replacements when possible. The
changes are not comprehensive, and there are still a lot of re.sub
usages lingering around the tree, but this already addresses a major
performance bottleneck in the testsuite driver that might has to do
with quadratic or worse slowdown in cpython's regular expression
engine when handling certain regex patterns with large strings.
Especially on i386, and i386 jobs are the bottlenecks of all full-ci
validate pipelines!
Here are the elapsed times of testing x86_64/i386 with -j48 before
this patch:
x86_64: `Build completed in 6m06s`
i386: `Build completed in 1h36m`
And with this patch:
x86_64: `Build completed in 4m55s`
i386: `Build completed in 4m23s`
Fixes #26786.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
88c93796 by Zubin Duggal at 2026-01-21T16:09:42-05:00
ghc-toolchain: Also configure windres on non-windows platforms.
It may be needed for cross compilation.
Fixes #24588
- - - - -
9788c0ec by Cheng Shao at 2026-01-21T16:10:24-05:00
ghci: print external interpreter trace messages to stderr instead of stdout
This patch makes ghci print external interpreter trace messages to
stderr instead of stdout, which is a much saner choice for diagnostic
information. Closes #26807.
- - - - -
0491f08a by Sylvain Henry at 2026-01-22T03:44:26-05:00
GC: don't use CAS without PARALLEL_GC on
If we're not using the parallel GC, there is no reason to do a costly
CAS. This was flagged as taking time in a perf profile.
- - - - -
211a8f56 by Sylvain Henry at 2026-01-22T03:44:26-05:00
GC: suffix parallel GC with "par" instead of "thr"
Avoid some potential confusion (see discussion in !15351).
- - - - -
77a23cbd by fendor at 2026-01-22T03:45:08-05:00
Remove blanket ignore that covers libraries/
- - - - -
18bf7f5c by LƩana Jiang at 2026-01-22T08:58:45-05:00
doc: update Flavour type in hadrian user-settings
- - - - -
3d5a1365 by Cheng Shao at 2026-01-22T08:59:28-05:00
hadrian: add missing notCross predicate for stage0 -O0
There are a few hard-coded hadrian args that pass -O0 when compiling
some heavy modules in stage0, which only makes sense when not
cross-compiling and when cross-compiling we need properly optimized
stage0 packages. So this patch adds the missing `notCross` predicate
in those places.
- - - - -
ee937134 by Matthew Pickering at 2026-01-22T09:00:10-05:00
Fix ghc-experimental GHC.Exception.Backtrace.Experimental module
This module wasn't added to the cabal file so it was never compiled or
included in the library.
- - - - -
1b490f5a by Zubin Duggal at 2026-01-22T09:00:53-05:00
hadrian: Add ghc-{experimental,internal}.cabal to the list of dependencies of the doc target
We need these files to detect the version of these libraries
Fixes #26738
- - - - -
cdb74049 by Cheng Shao at 2026-01-22T14:52:36-05:00
rts: avoid Cmm loop to initialize Array#/SmallArray#
Previously, `newArray#`/`newSmallArray#` called an RTS C function to
allocate the `Array#`/`SmallArray#`, then used a Cmm loop to
initialize the elements. Cmm doesn't have native for-loop so the code
is a bit awkward, and it's less efficient than a C loop, since the C
compiler can effectively vectorize the loop with optimizations.
So this patch moves the loop that initializes the elements to the C
side. `allocateMutArrPtrs`/`allocateSmallMutArrPtrs` now takes a new
`init` argument and initializes the elements if `init` is non-NULL.
- - - - -
4c784f00 by Cheng Shao at 2026-01-22T14:53:19-05:00
Fix testsuite run for +ipe flavour transformer
This patch makes the +ipe flavour transformer pass the entire
testsuite:
- An RTS debug option `-DI` is added, the IPE trace information is now
only printed with `-DI`. The test cases that do require IPE trace
are now run with `-DI`.
- The testsuite config option `ghc_with_ipe` is added, enabled when
running the testsuite with `+ipe`, which skips a few tests that are
sensitive to eventlog output, allocation patterns etc that can fail
under `+ipe`.
This is the first step towards #26799.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
be8e5236 by Ben Gamari at 2026-01-23T03:28:45-05:00
hadrian: Bump QuickCheck upper bound
This patch bumps QuickCheck upper bound to 2.18. selftest rule
manually tested to work with current latest QuickCheck-2.17.1.0.
- - - - -
5aa328fb by Zubin Duggal at 2026-01-23T03:29:30-05:00
Add genindex to index.rst. This adds a link to the index in the navigation bar.
Fixes #26437
- - - - -
61cc7615 by Wolfgang Jeltsch at 2026-01-23T16:00:56+02:00
Add operations for obtaining operating-system handles
This contribution implements CLC proposalĀ #369. It adds operations for
obtaining POSIX file descriptors and Windows handles that underlie
Haskell handles. Those operating system handles can also be obtained
without such additional operations, but this is more involved and, more
importantly, requires using internals.
- - - - -
602 changed files:
- .gitattributes
- .gitignore
- .gitlab/ci.sh
- .gitlab/generate-ci/gen_ci.hs
- + .gitlab/issue_templates/get-verified.md
- .gitlab/jobs.yaml
- .gitmodules
- CODEOWNERS
- cabal.project-reinstall
- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/PrimOps/Ids.hs
- compiler/GHC/Builtin/Utils.hs
- compiler/GHC/Cmm.hs
- compiler/GHC/Cmm/Info.hs
- compiler/GHC/Cmm/InitFini.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/Cmm/Utils.hs
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs
- compiler/GHC/CmmToAsm/Config.hs
- compiler/GHC/CmmToAsm/LA64/Ppr.hs
- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/CmmToAsm/PPC/Ppr.hs
- compiler/GHC/CmmToAsm/Ppr.hs
- compiler/GHC/CmmToAsm/RV64/Ppr.hs
- compiler/GHC/CmmToAsm/Reg/Graph.hs
- compiler/GHC/CmmToAsm/Reg/Graph/Coalesce.hs
- compiler/GHC/CmmToAsm/Reg/Graph/Spill.hs
- compiler/GHC/CmmToAsm/Reg/Graph/SpillCost.hs
- compiler/GHC/CmmToAsm/Reg/Linear.hs
- compiler/GHC/CmmToAsm/Reg/Linear/Base.hs
- compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs
- compiler/GHC/CmmToAsm/Reg/Linear/StackMap.hs
- compiler/GHC/CmmToAsm/Reg/Liveness.hs
- + compiler/GHC/CmmToAsm/Reg/Regs.hs
- compiler/GHC/CmmToAsm/Reg/Target.hs
- compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/CmmToAsm/X86/Ppr.hs
- compiler/GHC/CmmToC.hs
- compiler/GHC/CmmToLlvm.hs
- compiler/GHC/CmmToLlvm/Base.hs
- compiler/GHC/CmmToLlvm/CodeGen.hs
- compiler/GHC/CmmToLlvm/Data.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/InstEnv.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/CSE.hs
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/Pipeline/Types.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/Ppr.hs
- compiler/GHC/Core/Rules.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/Subst.hs
- compiler/GHC/Core/Tidy.hs
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Core/Unfold.hs
- compiler/GHC/Core/Unfold/Make.hs
- compiler/GHC/Core/Unify.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToIface.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/CodeOutput.hs
- compiler/GHC/Driver/Config/CmmToAsm.hs
- compiler/GHC/Driver/Config/Core/Lint.hs
- compiler/GHC/Driver/Config/Core/Lint/Interactive.hs
- compiler/GHC/Driver/Config/Core/Opt/Simplify.hs
- compiler/GHC/Driver/Config/Interpreter.hs
- compiler/GHC/Driver/Downsweep.hs
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/MakeFile.hs
- compiler/GHC/Driver/Pipeline.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/ImpExp.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/HsToCore.hs
- compiler/GHC/HsToCore/Binds.hs
- compiler/GHC/HsToCore/Errors/Types.hs
- compiler/GHC/HsToCore/Foreign/C.hs
- compiler/GHC/HsToCore/Foreign/JavaScript.hs
- compiler/GHC/HsToCore/Foreign/Wasm.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/HsToCore/Ticks.hs
- compiler/GHC/Iface/Make.hs
- compiler/GHC/Iface/Recomp.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Tidy.hs
- compiler/GHC/Iface/Warnings.hs
- compiler/GHC/IfaceToCore.hs
- compiler/GHC/Linker/Dynamic.hs
- compiler/GHC/Linker/Executable.hs
- compiler/GHC/Linker/Loader.hs
- compiler/GHC/Linker/Unit.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Errors/Ppr.hs
- compiler/GHC/Parser/Errors/Types.hs
- compiler/GHC/Parser/Lexer.x
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Parser/String.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Runtime/Interpreter/C.hs
- compiler/GHC/Runtime/Interpreter/Init.hs
- compiler/GHC/Settings.hs
- compiler/GHC/Settings/IO.hs
- compiler/GHC/Stg/EnforceEpt.hs
- compiler/GHC/Stg/Lint.hs
- compiler/GHC/StgToCmm/Bind.hs
- compiler/GHC/StgToCmm/Closure.hs
- compiler/GHC/StgToCmm/Expr.hs
- compiler/GHC/StgToCmm/InfoTableProv.hs
- compiler/GHC/StgToCmm/Utils.hs
- compiler/GHC/StgToJS/Linker/Utils.hs
- compiler/GHC/SysTools/Terminal.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Deriv/Generics.hs
- compiler/GHC/Tc/Deriv/Utils.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Hole.hs
- compiler/GHC/Tc/Errors/Hole/FitTypes.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Gen/Arrow.hs
- compiler/GHC/Tc/Gen/Export.hs
- compiler/GHC/Tc/Gen/Sig.hs
- compiler/GHC/Tc/Gen/Splice.hs
- compiler/GHC/Tc/Instance/Family.hs
- compiler/GHC/Tc/Instance/Typeable.hs
- compiler/GHC/Tc/Solver.hs
- compiler/GHC/Tc/Solver/Default.hs
- compiler/GHC/Tc/Solver/Dict.hs
- compiler/GHC/Tc/Solver/Equality.hs
- compiler/GHC/Tc/Solver/FunDeps.hs
- compiler/GHC/Tc/Solver/InertSet.hs
- compiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/Solver/Rewrite.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/Types/Constraint.hs
- compiler/GHC/Tc/Types/CtLoc.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Instantiate.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Utils/Unify.hs
- compiler/GHC/ThToHs.hs
- + compiler/GHC/Types/Arity.hs
- compiler/GHC/Types/Basic.hs
- compiler/GHC/Types/DefaultEnv.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/Hint.hs
- compiler/GHC/Types/Id.hs
- compiler/GHC/Types/Id/Info.hs
- compiler/GHC/Types/Id/Make.hs
- + compiler/GHC/Types/InlinePragma.hs
- compiler/GHC/Types/Name/Reader.hs
- compiler/GHC/Types/TyThing.hs
- compiler/GHC/Types/Unique/FM.hs
- compiler/GHC/Types/Unique/Set.hs
- compiler/GHC/Unit/Info.hs
- compiler/GHC/Unit/Module/Warnings.hs
- compiler/GHC/Unit/State.hs
- compiler/GHC/Utils/Binary.hs
- compiler/GHC/Utils/Outputable.hs
- compiler/Language/Haskell/Syntax/Binds.hs
- + compiler/Language/Haskell/Syntax/Binds/InlinePragma.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- compiler/Language/Haskell/Syntax/Extension.hs
- compiler/ghc.cabal.in
- config.guess
- config.sub
- configure.ac
- distrib/configure.ac.in
- ā docs/Makefile
- ā docs/storage-mgt/Makefile
- docs/users_guide/9.16.1-notes.rst
- ā docs/users_guide/Makefile
- docs/users_guide/exts/pragmas.rst
- docs/users_guide/exts/table.rst
- docs/users_guide/ghci.rst
- docs/users_guide/index.rst
- docs/users_guide/packages.rst
- docs/users_guide/phases.rst
- docs/users_guide/runtime_control.rst
- docs/users_guide/using-concurrent.rst
- docs/users_guide/using.rst
- docs/users_guide/wasm.rst
- docs/users_guide/win32-dlls.rst
- ā driver/Makefile
- ā driver/ghc/Makefile
- ā driver/ghci/Makefile
- driver/ghci/ghci.c
- ā driver/haddock/Makefile
- driver/utils/cwrapper.c
- driver/utils/isMinTTY.c
- ā driver/utils/merge_sections.ld
- ā driver/utils/merge_sections_pe.ld
- ghc/Main.hs
- ā ghc/Makefile
- hadrian/bindist/cwrappers/cwrapper.c
- hadrian/cabal.project
- hadrian/cfg/default.host.target.in
- hadrian/cfg/default.target.in
- hadrian/doc/flavours.md
- hadrian/doc/user-settings.md
- hadrian/hadrian.cabal
- hadrian/src/Base.hs
- hadrian/src/Builder.hs
- hadrian/src/Context.hs
- hadrian/src/Flavour.hs
- hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
- hadrian/src/Hadrian/Haskell/Cabal/Type.hs
- hadrian/src/Hadrian/Haskell/Hash.hs
- hadrian/src/Hadrian/Utilities.hs
- hadrian/src/Oracles/Flag.hs
- hadrian/src/Oracles/Setting.hs
- hadrian/src/Packages.hs
- hadrian/src/Rules.hs
- hadrian/src/Rules/BinaryDist.hs
- hadrian/src/Rules/CabalReinstall.hs
- hadrian/src/Rules/Docspec.hs
- hadrian/src/Rules/Documentation.hs
- hadrian/src/Rules/Generate.hs
- hadrian/src/Rules/Gmp.hs
- ā hadrian/src/Rules/Libffi.hs
- hadrian/src/Rules/Library.hs
- hadrian/src/Rules/Lint.hs
- hadrian/src/Rules/Program.hs
- hadrian/src/Rules/Register.hs
- hadrian/src/Rules/Rts.hs
- hadrian/src/Rules/SourceDist.hs
- hadrian/src/Rules/Test.hs
- hadrian/src/Settings/Builders/Cabal.hs
- hadrian/src/Settings/Builders/Ghc.hs
- hadrian/src/Settings/Builders/Hsc2Hs.hs
- ā hadrian/src/Settings/Builders/MergeObjects.hs
- hadrian/src/Settings/Builders/RunTest.hs
- hadrian/src/Settings/Builders/SplitSections.hs
- hadrian/src/Settings/Default.hs
- hadrian/src/Settings/Flavours/Benchmark.hs
- hadrian/src/Settings/Flavours/Development.hs
- hadrian/src/Settings/Flavours/GhcInGhci.hs
- hadrian/src/Settings/Flavours/Performance.hs
- hadrian/src/Settings/Flavours/Quick.hs
- hadrian/src/Settings/Flavours/QuickCross.hs
- hadrian/src/Settings/Flavours/Quickest.hs
- hadrian/src/Settings/Flavours/Validate.hs
- hadrian/src/Settings/Packages.hs
- hadrian/src/Settings/Program.hs
- ā libffi-tarballs
- ā libraries/Makefile
- libraries/base/base.cabal.in
- libraries/base/changelog.md
- libraries/base/src/Data/Array/Byte.hs
- libraries/base/src/Data/Bifoldable1.hs
- libraries/base/src/GHC/Conc.hs
- libraries/base/src/GHC/Conc/Sync.hs
- ā libraries/base/src/GHC/JS/Prim/Internal/Build.hs
- libraries/base/src/GHC/Num.hs
- ā libraries/base/src/GHC/Num/BigNat.hs
- ā libraries/base/src/GHC/Num/Integer.hs
- ā libraries/base/src/GHC/Num/Natural.hs
- libraries/base/src/System/CPUTime/Utils.hs
- libraries/base/src/System/IO.hs
- + libraries/base/src/System/IO/OS.hs
- libraries/base/tests/IO/T12010/cbits/initWinSock.c
- libraries/base/tests/IO/all.T
- + libraries/base/tests/IO/osHandles001FileDescriptors.hs
- + libraries/base/tests/IO/osHandles001FileDescriptors.stdout
- + libraries/base/tests/IO/osHandles001WindowsHandles.hs
- + libraries/base/tests/IO/osHandles001WindowsHandles.stdout
- + libraries/base/tests/IO/osHandles002FileDescriptors.hs
- + libraries/base/tests/IO/osHandles002FileDescriptors.stderr
- + libraries/base/tests/IO/osHandles002FileDescriptors.stdin
- + libraries/base/tests/IO/osHandles002FileDescriptors.stdout
- + libraries/base/tests/IO/osHandles002WindowsHandles.hs
- + libraries/base/tests/IO/osHandles002WindowsHandles.stderr
- + libraries/base/tests/IO/osHandles002WindowsHandles.stdin
- + libraries/base/tests/IO/osHandles002WindowsHandles.stdout
- ā libraries/doc/Makefile
- libraries/ghc-bignum/ghc-bignum.cabal
- libraries/ghc-boot/GHC/Unit/Database.hs
- libraries/ghc-compact/tests/all.T
- libraries/ghc-experimental/CHANGELOG.md
- libraries/ghc-experimental/ghc-experimental.cabal.in
- libraries/ghc-experimental/src/GHC/Exception/Backtrace/Experimental.hs
- libraries/ghc-experimental/src/GHC/TypeNats/Experimental.hs
- libraries/ghc-internal/cbits/consUtils.c
- libraries/ghc-internal/configure.ac
- libraries/ghc-internal/ghc-internal.buildinfo.in
- libraries/ghc-internal/ghc-internal.cabal.in
- libraries/ghc-internal/include/HsIntegerGmp.h.in
- libraries/ghc-internal/src/GHC/Internal/CString.hs
- libraries/ghc-internal/src/GHC/Internal/Classes.hs
- + libraries/ghc-internal/src/GHC/Internal/Classes/IP.hs
- libraries/ghc-internal/src/GHC/Internal/Conc/IO.hs
- libraries/ghc-internal/src/GHC/Internal/Conc/POSIX.hs
- libraries/ghc-internal/src/GHC/Internal/Conc/Sync.hs
- libraries/ghc-internal/src/GHC/Internal/Conc/Sync.hs-boot
- libraries/ghc-internal/src/GHC/Internal/Conc/Windows.hs
- libraries/ghc-internal/src/GHC/Internal/ConsoleHandler.hsc
- libraries/ghc-internal/src/GHC/Internal/Control/Monad.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Thread.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Windows/Thread.hs
- libraries/ghc-internal/src/GHC/Internal/Exception/Context.hs
- libraries/ghc-internal/src/GHC/Internal/Functor/ZipList.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Handle.hs
- + libraries/ghc-internal/src/GHC/Internal/STM.hs
- libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc
- libraries/ghc-internal/src/GHC/Internal/System/IO.hs
- + libraries/ghc-internal/src/GHC/Internal/System/IO/OS.hs
- libraries/ghc-internal/tests/backtraces/all.T
- libraries/ghc-platform/src/GHC/Platform/ArchOS.hs
- libraries/ghci/GHCi/Server.hs
- libraries/haskeline
- + libraries/libffi-clib
- libraries/mtl
- linters/lint-codes/LintCodes/Static.hs
- ā linters/lint-codes/Makefile
- ā linters/lint-notes/Makefile
- llvm-passes
- ā m4/find_ghc_bootstrap_prog.m4
- ā m4/fp_copy_shellvar.m4
- + m4/fp_linker_supports_verbatim.m4
- ā m4/fp_prog_ld_flag.m4
- ā m4/fp_prog_sort.m4
- m4/ghc_select_file_extensions.m4
- m4/prep_target_file.m4
- mk/system-cxx-std-lib-1.0.conf.in
- ā mk/win32-tarballs.md5sum
- packages
- rts/AllocArray.c
- rts/AllocArray.h
- rts/Apply.cmm
- rts/ClosureTable.c
- rts/Compact.cmm
- rts/ContinuationOps.cmm
- rts/Exception.cmm
- rts/Heap.c
- rts/Jumps.h
- ā rts/Makefile
- rts/PrimOps.cmm
- rts/RtsFlags.c
- rts/RtsMessages.c
- rts/StgMiscClosures.cmm
- rts/StgStartup.cmm
- rts/Threads.c
- rts/Trace.c
- rts/Weak.c
- rts/configure.ac
- rts/include/Cmm.h
- ā rts/include/Makefile
- rts/include/Stg.h
- rts/include/rts/Flags.h
- rts/include/rts/Messages.h
- rts/include/rts/ghc_ffi.h
- rts/include/stg/Ticky.h
- rts/linker/InitFini.c
- rts/prim/mulIntMayOflo.c
- rts/rts.buildinfo.in
- rts/rts.cabal
- rts/sm/Evac.c
- rts/sm/Evac_thr.c ā rts/sm/Evac_par.c
- rts/sm/Sanity.c
- rts/sm/Scav_thr.c ā rts/sm/Scav_par.c
- rts/sm/Storage.c
- ā rts/win32/libHSffi.def
- ā rts/win32/libHSghc-internal.def
- ā rts/win32/libHSghc-prim.def
- + testsuite/driver/_elffile.py
- testsuite/driver/perf_notes.py
- testsuite/driver/runtests.py
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/driver/testutil.py
- testsuite/ghc-config/ghc-config.hs
- testsuite/mk/test.mk
- testsuite/tests/count-deps/CountDepsAst.stdout
- testsuite/tests/count-deps/CountDepsParser.stdout
- testsuite/tests/deriving/should_fail/T8984.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail4.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail5.stderr
- testsuite/tests/diagnostic-codes/codes.stdout
- + testsuite/tests/dmdanal/should_run/T26748.hs
- + testsuite/tests/dmdanal/should_run/T26748.stdout
- testsuite/tests/dmdanal/should_run/all.T
- ā testsuite/tests/driver/T24731.hs
- testsuite/tests/driver/all.T
- + testsuite/tests/driver/fully-static/Hello.hs
- + testsuite/tests/driver/fully-static/Makefile
- + testsuite/tests/driver/fully-static/all.T
- + testsuite/tests/driver/fully-static/fully-static.stdout
- + testsuite/tests/driver/fully-static/test/Test.hs
- + testsuite/tests/driver/fully-static/test/test.pkg
- + testsuite/tests/driver/mostly-static/Hello.hs
- + testsuite/tests/driver/mostly-static/Makefile
- + testsuite/tests/driver/mostly-static/all.T
- + testsuite/tests/driver/mostly-static/mostly-static.stdout
- + testsuite/tests/driver/mostly-static/test/test.c
- + testsuite/tests/driver/mostly-static/test/test.h
- + testsuite/tests/driver/mostly-static/test/test.pkg
- + testsuite/tests/driver/recomp26183/M.hs
- + testsuite/tests/driver/recomp26183/M2A.hs
- + testsuite/tests/driver/recomp26183/M2B.hs
- + testsuite/tests/driver/recomp26183/Makefile
- + testsuite/tests/driver/recomp26183/all.T
- + testsuite/tests/driver/recomp26183/recomp26183.stderr
- + testsuite/tests/driver/recomp26705/M.hs
- + testsuite/tests/driver/recomp26705/M2A.hs
- + testsuite/tests/driver/recomp26705/M2B.hs
- + testsuite/tests/driver/recomp26705/Makefile
- + testsuite/tests/driver/recomp26705/all.T
- + testsuite/tests/driver/recomp26705/recomp26705.stderr
- testsuite/tests/ghci/scripts/T8353.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
- testsuite/tests/indexed-types/should_compile/CEqCanOccursCheck.hs
- testsuite/tests/indexed-types/should_fail/T12522a.hs
- testsuite/tests/indexed-types/should_fail/T26176.stderr
- 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/interface-stability/ghc-experimental-exports.stdout
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32
- testsuite/tests/interface-stability/ghc-prim-exports.stdout
- testsuite/tests/interface-stability/ghc-prim-exports.stdout-mingw32
- testsuite/tests/jsffi/all.T
- + testsuite/tests/jsffi/bytearrayarg.hs
- + testsuite/tests/jsffi/bytearrayarg.mjs
- + testsuite/tests/jsffi/bytearrayarg.stdout
- testsuite/tests/numeric/should_run/all.T
- testsuite/tests/numeric/should_run/foundation.hs
- testsuite/tests/numeric/should_run/foundation.stdout
- testsuite/tests/overloadedrecflds/should_fail/DRFHoleFits.stderr
- testsuite/tests/parser/should_fail/RecordDotSyntaxFail10.stderr
- testsuite/tests/parser/should_fail/RecordDotSyntaxFail13.stderr
- testsuite/tests/parser/should_fail/T20654a.stderr
- testsuite/tests/patsyn/should_fail/all.T
- + testsuite/tests/patsyn/should_fail/import-syntax-no-ext.hs
- + testsuite/tests/patsyn/should_fail/import-syntax-no-ext.stderr
- testsuite/tests/perf/compiler/hard_hole_fits.stderr
- testsuite/tests/perf/should_run/all.T
- testsuite/tests/plugins/test-hole-plugin.stderr
- testsuite/tests/pmcheck/should_compile/T15753c.hs
- + testsuite/tests/pmcheck/should_compile/T15753c.stderr
- testsuite/tests/pmcheck/should_compile/T15753d.hs
- + testsuite/tests/pmcheck/should_compile/T15753d.stderr
- + testsuite/tests/pmcheck/should_compile/T22652.hs
- + testsuite/tests/pmcheck/should_compile/T22652a.hs
- + testsuite/tests/pmcheck/should_compile/T24867.hs
- + testsuite/tests/pmcheck/should_compile/T24867.stderr
- testsuite/tests/pmcheck/should_compile/all.T
- + testsuite/tests/polykinds/T13882.hs
- testsuite/tests/polykinds/all.T
- testsuite/tests/quantified-constraints/T15316A.stderr
- testsuite/tests/quantified-constraints/T17267.stderr
- testsuite/tests/quantified-constraints/T17267a.stderr
- testsuite/tests/quantified-constraints/T17267b.stderr
- testsuite/tests/quantified-constraints/T17267c.stderr
- testsuite/tests/quantified-constraints/T17267e.stderr
- testsuite/tests/quantified-constraints/T17458.stderr
- + testsuite/tests/rename/should_compile/T25901_sub_e.hs
- + testsuite/tests/rename/should_compile/T25901_sub_f.hs
- + testsuite/tests/rename/should_compile/T25901_sub_f.stderr
- + testsuite/tests/rename/should_compile/T25901_sub_g.hs
- + testsuite/tests/rename/should_compile/T25901_sub_g.stderr
- + testsuite/tests/rename/should_compile/T25901_sub_g_helper.hs
- testsuite/tests/rename/should_compile/all.T
- testsuite/tests/rename/should_fail/T23570b.stderr
- + testsuite/tests/rename/should_fail/T25901_sub_a.hs
- + testsuite/tests/rename/should_fail/T25901_sub_a.stderr
- + testsuite/tests/rename/should_fail/T25901_sub_b.hs
- + testsuite/tests/rename/should_fail/T25901_sub_b.stderr
- + testsuite/tests/rename/should_fail/T25901_sub_c.hs
- + testsuite/tests/rename/should_fail/T25901_sub_c.stderr
- + testsuite/tests/rename/should_fail/T25901_sub_c_helper.hs
- + testsuite/tests/rename/should_fail/T25901_sub_d.hs
- + testsuite/tests/rename/should_fail/T25901_sub_d.stderr
- + testsuite/tests/rename/should_fail/T25901_sub_d_helper.hs
- + testsuite/tests/rename/should_fail/T25901_sub_w.hs
- + testsuite/tests/rename/should_fail/T25901_sub_w.stderr
- testsuite/tests/rename/should_fail/all.T
- testsuite/tests/rts/Makefile
- testsuite/tests/rts/all.T
- testsuite/tests/rts/ipe/all.T
- testsuite/tests/rts/linker/rdynamic.hs
- + testsuite/tests/simd/should_run/T26411.hs
- + testsuite/tests/simd/should_run/T26411.stdout
- + testsuite/tests/simd/should_run/T26411b.hs
- + testsuite/tests/simd/should_run/T26411b.stdout
- testsuite/tests/simd/should_run/all.T
- testsuite/tests/simplCore/should_compile/T14003.stderr
- testsuite/tests/simplCore/should_compile/T18013.stderr
- testsuite/tests/simplCore/should_compile/T19672.stderr
- testsuite/tests/simplCore/should_compile/T21763.stderr
- testsuite/tests/simplCore/should_compile/T21763a.stderr
- + testsuite/tests/simplCore/should_compile/T26615.hs
- + testsuite/tests/simplCore/should_compile/T26615.stderr
- + testsuite/tests/simplCore/should_compile/T26615a.hs
- + testsuite/tests/simplCore/should_compile/T26681.hs
- + testsuite/tests/simplCore/should_compile/T26682.hs
- + testsuite/tests/simplCore/should_compile/T26682a.hs
- + testsuite/tests/simplCore/should_compile/T26709.hs
- + testsuite/tests/simplCore/should_compile/T26709.stderr
- + testsuite/tests/simplCore/should_compile/T26722.hs
- + testsuite/tests/simplCore/should_compile/T26722.stderr
- testsuite/tests/simplCore/should_compile/T4908.stderr
- testsuite/tests/simplCore/should_compile/all.T
- testsuite/tests/simplCore/should_compile/spec-inline.stderr
- testsuite/tests/simplStg/should_compile/all.T
- testsuite/tests/th/T15321.stderr
- testsuite/tests/th/TH_implicitParams.stdout
- testsuite/tests/typecheck/should_compile/T13050.stderr
- testsuite/tests/typecheck/should_compile/T14273.stderr
- testsuite/tests/typecheck/should_compile/T14590.stderr
- testsuite/tests/typecheck/should_compile/T16188.hs
- testsuite/tests/typecheck/should_compile/T25180.stderr
- + testsuite/tests/typecheck/should_compile/T26737.hs
- + testsuite/tests/typecheck/should_compile/T26746.hs
- testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr
- testsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_compile/constraint_hole_fits.stderr
- testsuite/tests/typecheck/should_compile/free_monad_hole_fits.stderr
- testsuite/tests/typecheck/should_compile/hole_constraints.stderr
- testsuite/tests/typecheck/should_compile/holes.stderr
- testsuite/tests/typecheck/should_compile/holes2.stderr
- testsuite/tests/typecheck/should_compile/holes3.stderr
- testsuite/tests/typecheck/should_compile/refinement_hole_fits.stderr
- testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr
- testsuite/tests/typecheck/should_compile/type_in_type_hole_fits.stderr
- testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr
- testsuite/tests/typecheck/should_compile/valid_hole_fits_interactions.stderr
- testsuite/tests/typecheck/should_fail/ContextStack1.stderr
- testsuite/tests/typecheck/should_fail/FD3.stderr
- testsuite/tests/typecheck/should_fail/FDsFromGivens2.stderr
- testsuite/tests/typecheck/should_fail/FunDepOrigin1b.stderr
- testsuite/tests/typecheck/should_fail/T13506.stderr
- testsuite/tests/typecheck/should_fail/T14884.stderr
- testsuite/tests/typecheck/should_fail/T15767.stderr
- testsuite/tests/typecheck/should_fail/T15801.stderr
- testsuite/tests/typecheck/should_fail/T19415.stderr
- testsuite/tests/typecheck/should_fail/T19415b.stderr
- testsuite/tests/typecheck/should_fail/T22924b.stderr
- + testsuite/tests/typecheck/should_fail/T23162b.hs
- + testsuite/tests/typecheck/should_fail/T23162b.stderr
- + testsuite/tests/typecheck/should_fail/T23162c.hs
- + testsuite/tests/typecheck/should_fail/T23162d.hs
- testsuite/tests/typecheck/should_fail/T25325.stderr
- testsuite/tests/typecheck/should_fail/T5236.stderr
- testsuite/tests/typecheck/should_fail/T5246.stderr
- testsuite/tests/typecheck/should_fail/T5978.stderr
- testsuite/tests/typecheck/should_fail/T9612.stderr
- testsuite/tests/typecheck/should_fail/TcCoercibleFail.hs
- testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr
- testsuite/tests/typecheck/should_fail/all.T
- testsuite/tests/typecheck/should_fail/tcfail143.stderr
- testsuite/tests/warnings/should_compile/DodgyExports03.stderr
- testsuite/tests/warnings/should_compile/DodgyImports.stderr
- + testsuite/tests/warnings/should_compile/DodgyImports02.hs
- + testsuite/tests/warnings/should_compile/DodgyImports02.stderr
- + testsuite/tests/warnings/should_compile/DodgyImports03.hs
- + testsuite/tests/warnings/should_compile/DodgyImports03.stderr
- + testsuite/tests/warnings/should_compile/DodgyImports03_helper.hs
- + testsuite/tests/warnings/should_compile/DodgyImports04.hs
- + testsuite/tests/warnings/should_compile/DodgyImports04.stderr
- testsuite/tests/warnings/should_compile/DodgyImports_hiding.stderr
- testsuite/tests/warnings/should_compile/all.T
- utils/check-exact/ExactPrint.hs
- utils/deriveConstants/Main.hs
- utils/genapply/Main.hs
- utils/ghc-pkg/Main.hs
- utils/ghc-toolchain/exe/Main.hs
- utils/ghc-toolchain/src/GHC/Toolchain/Tools/Link.hs
- utils/haddock/haddock-api/src/Haddock/Convert.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Create.hs
- ā utils/iserv/cbits/iservmain.c
- ā utils/iserv/iserv.cabal.in
- ā utils/iserv/src/Main.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/454b5730939635739f1d5a82b6288eā¦
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/454b5730939635739f1d5a82b6288eā¦
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/andreask/ticked_joins] Allow join point Ids to occur below ticks & casts
by sheaf (ļ¼ sheaf) 23 Jan '26
by sheaf (ļ¼ sheaf) 23 Jan '26
23 Jan '26
sheaf pushed to branch wip/andreask/ticked_joins at Glasgow Haskell Compiler / GHC
Commits:
871a1207 by sheaf at 2026-01-23T13:36:01+01:00
Allow join point Ids to occur below ticks & casts
This commit classifies all join points into two categories:
- true join points
- quasi join points
A quasi join point is a join point in which one of the binders occurs
under more profiling ticks or casts than its binding site.
The only operational difference is that, for quasi join points, we
cannot perform the case-of-case transformation described in
Note [Join points and case-of-case] in GHC.Core.Opt.Simplify.Iteration.
All of this is explained in detail in Note [Quasi join points].
Fixes #26693 and #26642
Improves on #26157 and #26422, but doesn't entirely fix them because
in an ideal world casts & profiling ticks should not inhibit optimisations.
-------------------------
Metric Increase:
T21839c
T9961
-------------------------
- - - - -
13 changed files:
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Types/Basic.hs
- compiler/GHC/Types/Tickish.hs
- testsuite/tests/profiling/should_run/T2552.prof.sample
- testsuite/tests/profiling/should_run/ioprof.prof.sample
- testsuite/tests/profiling/should_run/scc001.prof.sample
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/871a1207c6f677988562b3df232bd3bā¦
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/871a1207c6f677988562b3df232bd3bā¦
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/T25262] Use template-haskell-lift/quasiquoter in boot libraries
by Teo Camarasu (ļ¼ teo) 23 Jan '26
by Teo Camarasu (ļ¼ teo) 23 Jan '26
23 Jan '26
Teo Camarasu pushed to branch wip/T25262 at Glasgow Haskell Compiler / GHC
Commits:
e11d23eb by Teo Camarasu at 2026-01-23T12:34:26+00:00
Use template-haskell-lift/quasiquoter in boot libraries
- - - - -
19 changed files:
- compiler/ghc.cabal.in
- ghc/ghc-bin.cabal.in
- hadrian/hadrian.cabal
- libraries/Cabal
- libraries/bytestring
- libraries/containers
- libraries/exceptions
- libraries/filepath
- libraries/ghc-boot/ghc-boot.cabal.in
- libraries/ghc-compact/ghc-compact.cabal
- libraries/ghc-internal/tools/ucd2haskell/ucd2haskell.cabal
- libraries/ghci/ghci.cabal.in
- libraries/haskeline
- libraries/os-string
- libraries/parsec
- libraries/text
- libraries/time
- libraries/unix
- utils/iserv/iserv.cabal.in
Changes:
=====================================
compiler/ghc.cabal.in
=====================================
@@ -118,7 +118,7 @@ Library
deepseq >= 1.4 && < 1.6,
directory >= 1 && < 1.4,
process >= 1 && < 1.7,
- bytestring >= 0.11 && < 0.13,
+ bytestring >= 0.11 && < 0.14,
binary == 0.8.*,
time >= 1.4 && < 1.16,
containers >= 0.6.2.1 && < 0.9,
=====================================
ghc/ghc-bin.cabal.in
=====================================
@@ -36,7 +36,7 @@ Executable ghc
GHC.Driver.Session.Mode
Build-Depends: base >= 4 && < 5,
array >= 0.1 && < 0.6,
- bytestring >= 0.9 && < 0.13,
+ bytestring >= 0.9 && < 0.14,
directory >= 1 && < 1.4,
process >= 1 && < 1.7,
filepath >= 1.5 && < 1.6,
=====================================
hadrian/hadrian.cabal
=====================================
@@ -155,7 +155,7 @@ executable hadrian
, TypeFamilies
build-depends: Cabal >= 3.13 && < 3.17
, base >= 4.11 && < 5
- , bytestring >= 0.10 && < 0.13
+ , bytestring >= 0.10 && < 0.14
, containers >= 0.5 && < 0.9
-- N.B. directory >=1.3.9 as earlier versions are
-- afflicted by #24382.
=====================================
libraries/Cabal
=====================================
@@ -1 +1 @@
-Subproject commit d9b0904b49dc84e0bfc79062daf2bbdf9d22a422
+Subproject commit bf964ddcc8e9c3c0a3ae46ab88c020046ac5e402
=====================================
libraries/bytestring
=====================================
@@ -1 +1 @@
-Subproject commit d984ad00644c0157bad04900434b9d36f23633c5
+Subproject commit 754b7a7741f050eb42706b8bbddbf21184a0f7d5
=====================================
libraries/containers
=====================================
@@ -1 +1 @@
-Subproject commit 801b06e5d4392b028e519d5ca116a2881d559721
+Subproject commit 8147f030783c23936f1e974f56e1b9b3993724f3
=====================================
libraries/exceptions
=====================================
@@ -1 +1 @@
-Subproject commit b6c4290124eb1138358bf04ad9f33e67f6c5c1d8
+Subproject commit 6268676cddc3dfc164896bcb981054fe49d6ba91
=====================================
libraries/filepath
=====================================
@@ -1 +1 @@
-Subproject commit cbcd0ccf92f47e6c10fb9cc513a7b26facfc19fe
+Subproject commit 14fb430d8c33948598226af83c120e02bb36ce32
=====================================
libraries/ghc-boot/ghc-boot.cabal.in
=====================================
@@ -77,7 +77,7 @@ Library
build-depends: base >= 4.7 && < 4.23,
binary == 0.8.*,
- bytestring >= 0.10 && < 0.13,
+ bytestring >= 0.10 && < 0.14,
containers >= 0.5 && < 0.9,
directory >= 1.2 && < 1.4,
filepath >= 1.3 && < 1.6,
=====================================
libraries/ghc-compact/ghc-compact.cabal
=====================================
@@ -40,7 +40,7 @@ library
CPP
build-depends: base >= 4.9.0 && < 4.23,
- bytestring >= 0.10.6.0 && <0.13
+ bytestring >= 0.10.6.0 && <0.14
ghc-options: -Wall
exposed-modules: GHC.Compact
=====================================
libraries/ghc-internal/tools/ucd2haskell/ucd2haskell.cabal
=====================================
@@ -53,7 +53,7 @@ executable ucd2haskell
Generator.WordEncoding
build-depends:
base >= 4.7 && < 5
- , bytestring >= 0.11 && < 0.13
+ , bytestring >= 0.11 && < 0.14
, directory >= 1.3.6 && < 1.4
, filepath >= 1.4.2 && < 1.6
, getopt-generics >= 0.13 && < 0.14
=====================================
libraries/ghci/ghci.cabal.in
=====================================
@@ -89,7 +89,7 @@ library
ghc-internal >= 9.1001.0 && <=@ProjectVersionForLib@.0,
ghc-prim >= 0.5.0 && < 0.14,
binary == 0.8.*,
- bytestring >= 0.10 && < 0.13,
+ bytestring >= 0.10 && < 0.14,
containers >= 0.5 && < 0.9,
deepseq >= 1.4 && < 1.6,
filepath >= 1.4 && < 1.6,
=====================================
libraries/haskeline
=====================================
@@ -1 +1 @@
-Subproject commit 991953cd5d3bb9e8057de4a0d8f2cae3455865d8
+Subproject commit c61650dc4cbbb4b7f5c8f96ccb23bb48dc5f580f
=====================================
libraries/os-string
=====================================
@@ -1 +1 @@
-Subproject commit 2e693aad07540173a0169971b27c9acac28eeff1
+Subproject commit cf53b19b2d5933b53d77abada1f08a88c455a8b7
=====================================
libraries/parsec
=====================================
@@ -1 +1 @@
-Subproject commit 552730e23e1fd2dae46a60d75138b8d173492462
+Subproject commit cbd35433d33a05676266d516e612b0aa31d5a5bc
=====================================
libraries/text
=====================================
@@ -1 +1 @@
-Subproject commit 5f343f668f421bfb30cead594e52d0ac6206ff67
+Subproject commit a1fd01da2bc44b255b3dd11f5a9cf098c388d6a1
=====================================
libraries/time
=====================================
@@ -1 +1 @@
-Subproject commit 507f50844802f1469ba6cadfeefd4e3fecee0416
+Subproject commit a6cb12065d8f52d6d3ef014ae580eb3a6ad82f09
=====================================
libraries/unix
=====================================
@@ -1 +1 @@
-Subproject commit c9b3e95b5c15b118e55522bd92963038c6a88160
+Subproject commit 2076de9eabaeeca54e6e5715f26798248abaf67d
=====================================
utils/iserv/iserv.cabal.in
=====================================
@@ -33,7 +33,7 @@ Executable iserv
Build-Depends: array >= 0.5 && < 0.6,
base >= 4 && < 5,
binary >= 0.7 && < 0.11,
- bytestring >= 0.10 && < 0.13,
+ bytestring >= 0.10 && < 0.14,
containers >= 0.5 && < 0.9,
deepseq >= 1.4 && < 1.6,
ghci == @ProjectVersionMunged@
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e11d23eb332209f0eaece746bbd6871ā¦
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e11d23eb332209f0eaece746bbd6871ā¦
You're receiving this email because of your account on gitlab.haskell.org.
1
0