[Git][ghc/ghc][master] 2 commits: Extend record-selector usage ticking to all binds using a record field

Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 62899117 by Florian Ragwitz at 2025-08-13T21:01:34-04:00 Extend record-selector usage ticking to all binds using a record field This extends the previous handling of ticking for RecordWildCards and NamedFieldPuns to all var bindings that involve record selectors. Note that certain patterns such as `Foo{foo = 42}` will currently not tick the `foo` selector, as ticking is triggered by `HsVar`s. Closes #26191. - - - - - b37b3af7 by Florian Ragwitz at 2025-08-13T21:01:34-04:00 Add release notes for 9.16.1 and move description of latest HPC changes there. - - - - - 6 changed files: - compiler/GHC/HsToCore/Ticks.hs - − docs/users_guide/9.14.1-notes.rst - + docs/users_guide/9.16.1-notes.rst - docs/users_guide/release-notes.rst - testsuite/tests/hpc/recsel/recsel.hs - testsuite/tests/hpc/recsel/recsel.stdout Changes: ===================================== compiler/GHC/HsToCore/Ticks.hs ===================================== @@ -251,7 +251,7 @@ addTickLHsBind (L pos (XHsBindsLR bind@(AbsBinds { abs_binds = binds add_rec_sels env = env{ recSelBinds = recSelBinds env `extendVarEnvList` - [ (abe_mono, abe_poly) + [ (abe_mono, unitDVarSet abe_poly) | ABE{ abe_poly, abe_mono } <- abs_exports , RecSelId{} <- [idDetails abe_poly] ] } @@ -270,8 +270,8 @@ addTickLHsBind (L pos (funBind@(FunBind { fun_id = L _ id, fun_matches = matches case tickish of { ProfNotes | inline -> return (L pos funBind); _ -> do -- See Note [Record-selector ticks] - selTick <- recSelTick id - case selTick of { Just tick -> tick_rec_sel tick; _ -> do + selTicks <- recSelTick id + case selTicks of { Just ticks -> tick_rec_sel ticks; _ -> do (fvs, mg) <- getFreeVars $ @@ -303,8 +303,8 @@ addTickLHsBind (L pos (funBind@(FunBind { fun_id = L _ id, fun_matches = matches } } where -- See Note [Record-selector ticks] - tick_rec_sel tick = - pure $ L pos $ funBind { fun_ext = second (tick :) (fun_ext funBind) } + tick_rec_sel ticks = + pure $ L pos $ funBind { fun_ext = second (ticks ++) (fun_ext funBind) } -- Note [Record-selector ticks] @@ -319,9 +319,8 @@ addTickLHsBind (L pos (funBind@(FunBind { fun_id = L _ id, fun_matches = matches -- coverage purposes to improve the developer experience. -- -- This is done by keeping track of which 'Id's are effectively bound to --- record fields (using NamedFieldPuns or RecordWildCards) in 'TickTransEnv's --- 'recSelBinds', and making 'HsVar's corresponding to those fields tick the --- appropriate box when executed. +-- record fields in 'TickTransEnv's 'recSelBinds', and making 'HsVar's +-- corresponding to those fields tick the appropriate box when executed. -- -- To enable that, we also treat 'FunBind's for record selector functions -- specially. We only create a TopLevelBox for the record selector function, @@ -329,11 +328,11 @@ addTickLHsBind (L pos (funBind@(FunBind { fun_id = L _ id, fun_matches = matches -- of ticks for the same record selector, and is done by not recursing into -- the fun_matches match group for record selector functions. -- +-- Note that due to the use of 'HsVar's for ticking, certain patterns such +-- as `Foo{foo = 42}` will not cause the `foo` selector to be ticked. +-- -- This scheme could be extended further in the future, making coverage for --- constructor fields (named or even positional) mean that the field was --- accessed at run-time. For the time being, we only cover NamedFieldPuns and --- RecordWildCards binds to cover most practical use-cases while keeping it --- simple. +-- positional constructor fields mean that the field was accessed at run-time. -- TODO: Revisit this addTickLHsBind (L pos (pat@(PatBind { pat_lhs = lhs @@ -519,7 +518,7 @@ addTickHsExpr :: HsExpr GhcTc -> TM (HsExpr GhcTc) -- See Note [Record-selector ticks] addTickHsExpr e@(HsVar _ (L _ id)) = freeVar id >> recSelTick id >>= pure . maybe e wrap - where wrap tick = XExpr . HsTick tick . noLocA $ e + where wrap = foldr (\tick -> XExpr . HsTick tick . noLocA) e addTickHsExpr e@(HsIPVar {}) = return e addTickHsExpr e@(HsOverLit {}) = return e addTickHsExpr e@(HsOverLabel{}) = return e @@ -1086,7 +1085,7 @@ data TickTransEnv = TTE { fileName :: FastString , blackList :: Set RealSrcSpan , this_mod :: Module , tickishType :: TickishType - , recSelBinds :: IdEnv Id + , recSelBinds :: IdEnv DVarSet } -- deriving Show @@ -1241,11 +1240,12 @@ allocTickBox boxLabel countEntries topOnly pos m tickish <- mkTickish boxLabel countEntries topOnly pos fvs (declPath env) return (this_loc (XExpr $ HsTick tickish $ this_loc e)) -recSelTick :: Id -> TM (Maybe CoreTickish) +recSelTick :: Id -> TM (Maybe [CoreTickish]) recSelTick id = ifDensity TickForCoverage maybe_tick (pure Nothing) where maybe_tick = getEnv >>= - maybe (pure Nothing) tick . (`lookupVarEnv` id) . recSelBinds + maybe (pure Nothing) tick_all . (`lookupVarEnv` id) . recSelBinds + tick_all = fmap (Just . catMaybes) . mapM tick . dVarSetElems tick sel = getState >>= maybe (alloc sel) (pure . Just) . (`lookupVarEnv` sel) . recSelTicks alloc sel = allocATickBox (box sel) False False (getSrcSpan sel) noFVs @@ -1367,7 +1367,7 @@ class CollectBinders a where -- -- See Note [Record-selector ticks]. class CollectFldBinders a where - collectFldBinds :: a -> IdEnv Id + collectFldBinds :: a -> IdEnv DVarSet instance CollectBinders (LocatedA (Pat GhcTc)) where collectBinds = collectPatBinders CollNoDictBinders @@ -1385,41 +1385,37 @@ instance (CollectFldBinders a) => CollectFldBinders [a] where instance (CollectFldBinders e) => CollectFldBinders (GenLocated l e) where collectFldBinds = collectFldBinds . unLoc instance CollectFldBinders (Pat GhcTc) where - collectFldBinds ConPat{ pat_args = RecCon HsRecFields{ rec_flds, rec_dotdot } } = - collectFldBinds rec_flds `plusVarEnv` plusVarEnvList (zipWith fld_bnds [0..] rec_flds) - where n_explicit | Just (L _ (RecFieldsDotDot n)) <- rec_dotdot = n - | otherwise = length rec_flds - fld_bnds n (L _ HsFieldBind{ hfbLHS = L _ FieldOcc{ foLabel = L _ sel } - , hfbRHS = L _ (VarPat _ (L _ var)) - , hfbPun }) - | hfbPun || n >= n_explicit = unitVarEnv var sel - fld_bnds _ _ = emptyVarEnv - collectFldBinds ConPat{ pat_args = PrefixCon pats } = collectFldBinds pats - collectFldBinds ConPat{ pat_args = InfixCon p1 p2 } = collectFldBinds [p1, p2] - collectFldBinds (LazyPat _ pat) = collectFldBinds pat - collectFldBinds (BangPat _ pat) = collectFldBinds pat - collectFldBinds (AsPat _ _ pat) = collectFldBinds pat - collectFldBinds (ViewPat _ _ pat) = collectFldBinds pat - collectFldBinds (ParPat _ pat) = collectFldBinds pat - collectFldBinds (ListPat _ pats) = collectFldBinds pats - collectFldBinds (TuplePat _ pats _) = collectFldBinds pats - collectFldBinds (SumPat _ pats _ _) = collectFldBinds pats - collectFldBinds (SigPat _ pat _) = collectFldBinds pat - collectFldBinds (XPat exp) = collectFldBinds exp - collectFldBinds VarPat{} = emptyVarEnv - collectFldBinds WildPat{} = emptyVarEnv - collectFldBinds OrPat{} = emptyVarEnv - collectFldBinds LitPat{} = emptyVarEnv - collectFldBinds NPat{} = emptyVarEnv - collectFldBinds NPlusKPat{} = emptyVarEnv - collectFldBinds SplicePat{} = emptyVarEnv - collectFldBinds EmbTyPat{} = emptyVarEnv - collectFldBinds InvisPat{} = emptyVarEnv -instance (CollectFldBinders r) => CollectFldBinders (HsFieldBind l r) where - collectFldBinds = collectFldBinds . hfbRHS -instance CollectFldBinders XXPatGhcTc where - collectFldBinds (CoPat _ pat _) = collectFldBinds pat - collectFldBinds (ExpansionPat _ pat) = collectFldBinds pat + collectFldBinds = go emptyDVarSet where + go sels ConPat{ pat_args = RecCon HsRecFields{ rec_flds } } = + plusVarEnvList (map fld_binds rec_flds) + where fld_binds (L _ HsFieldBind{ hfbLHS = L _ FieldOcc{ foLabel = L _ sel } + , hfbRHS = L _ rhs }) + = go (extendDVarSet sels sel) rhs + go sels ConPat{ pat_args = PrefixCon ps } = + plusVarEnvList (map (go sels . unLoc) ps) + go sels ConPat{ pat_args = InfixCon (L _ p1) (L _ p2) } = + go sels p1 `plusVarEnv` go sels p2 + go sels (VarPat _ (L _ var)) | isEmptyDVarSet sels = emptyVarEnv + | otherwise = unitVarEnv var sels + go sels (LazyPat _ (L _ p)) = go sels p + go sels (BangPat _ (L _ p)) = go sels p + go sels (AsPat _ _ (L _ p)) = go sels p + go sels (ViewPat _ _ (L _ p)) = go sels p + go sels (ParPat _ (L _ p)) = go sels p + go sels (SigPat _ (L _ p) _) = go sels p + go sels (SumPat _ (L _ p) _ _) = go sels p + go sels (XPat (CoPat _ p _)) = go sels p + go sels (XPat (ExpansionPat _ p)) = go sels p + go sels (ListPat _ ps) = plusVarEnvList (map (go sels . unLoc) ps) + go sels (TuplePat _ ps _) = plusVarEnvList (map (go sels . unLoc) ps) + go _ WildPat{} = emptyVarEnv + go _ OrPat{} = emptyVarEnv + go _ LitPat{} = emptyVarEnv + go _ NPat{} = emptyVarEnv + go _ NPlusKPat{} = emptyVarEnv + go _ SplicePat{} = emptyVarEnv + go _ EmbTyPat{} = emptyVarEnv + go _ InvisPat{} = emptyVarEnv instance CollectFldBinders (HsLocalBinds GhcTc) where collectFldBinds (HsValBinds _ bnds) = collectFldBinds bnds collectFldBinds HsIPBinds{} = emptyVarEnv @@ -1430,9 +1426,9 @@ instance CollectFldBinders (HsValBinds GhcTc) where instance CollectFldBinders (HsBind GhcTc) where collectFldBinds PatBind{ pat_lhs } = collectFldBinds pat_lhs collectFldBinds (XHsBindsLR AbsBinds{ abs_exports, abs_binds }) = - mkVarEnv [ (abe_poly, sel) + mkVarEnv [ (abe_poly, sels) | ABE{ abe_poly, abe_mono } <- abs_exports - , Just sel <- [lookupVarEnv monos abe_mono] ] + , Just sels <- [lookupVarEnv monos abe_mono] ] where monos = collectFldBinds abs_binds collectFldBinds VarBind{} = emptyVarEnv collectFldBinds FunBind{} = emptyVarEnv ===================================== docs/users_guide/9.14.1-notes.rst deleted ===================================== @@ -1,290 +0,0 @@ -.. _release-9-14-1: - -Version 9.14.1 -============== - -The significant changes to the various parts of the compiler are listed in the -following sections. See the `migration guide -https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.14`_ on the GHC Wiki -for specific guidance on migrating programs to this release. - -Language -~~~~~~~~ - -* `GHC proposal 493: allow expressions in SPECIALISE pragmas https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0493-sp...`_ - has been implemented. SPECIALISE pragmas now allow arbitrary expressions such as: :: - - {-# SPECIALISE f @Int False :: Int -> Char #-} - - The ability to specify multiple specialisations in a single SPECIALISE pragma, - with syntax of the form (note the comma between the type signatures): :: - - {-# SPECIALISE g : Int -> Int, Float -> Float #-} - - has been deprecated, and is scheduled to be removed in GHC 9.18. - This deprecation is controlled by the newly introduced ``-Wdeprecated-pragmas`` - flag in ``-Wdefault``. - -* ``-Wincomplete-record-selectors`` is now part of `-Wall`, as specified - by `GHC Proposal 516: add warning for incomplete record selectors https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0516-in...`_. - Hence, if a library is compiled with ``-Werror``, compilation may now fail. Solution: fix the library. - Workaround: add ``-Werror=no-incomplete-record-selectors``. - - Note that this warning is at least - as serious as a warning about missing patterns from a function definition, perhaps even - more so, since it is invisible in the source program. - -* The combination of :extension:`ScopedTypeVariables` and :extension:`TypeApplications` - no longer enables type applications in patterns, which now always requires - :extension:`TypeAbstractions`. The warning flag``deprecated-type-abstractions`` - has also been removed from the compiler. - -* :extension:`OverloadedRecordUpdate` now passes the arguments to a ``setField`` function - in the flipped order, as specified by `GHC Proposal 583: HasField redesign https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0583-ha...`_. - - Previously GHC expected ``setField`` to have this type: :: - - setField :: forall (fld :: Symbol) a r. r -> a -> r - - And that's what GHC expects now: :: - - setField :: forall (fld :: Symbol) a r. a -> r -> r - - That will break the combination of :extension:`OverloadedRecordUpdate` with :extension:`RebindableSyntax`. - -* Multiline strings are now accepted in foreign imports. (#25157) - -* GHC now does a better job at inferring types in calls to ``coerce``: instead of - complaining about ambiguous type variables, GHC will consider that such type - variables are determined by the ``Coercible`` constraints they appear in. - -* With :extension:`LinearTypes` record fields can now be non-linear. This means that - the following record declaration is now valid: - - :: - - data Record = Rec { x %'Many :: Int, y :: Char } - - This causes the constructor to have type ``Rec :: Int %'Many -> Char %1 -> Record``. - -* The :extension:`ExplicitNamespaces` extension now allows the ``data`` - namespace specifier in import and export lists. - -* The ``-Wdata-kinds-tc`` warning has been deprecated, and the use of promoted - data types in kinds is now an error (rather than a warning) unless the - :extension:`DataKinds` extension is enabled. For example, the following code - will be rejected unless :extension:`DataKinds` is on: - - import Data.Kind (Type) - import GHC.TypeNats (Nat) - - -- Nat shouldn't be allowed here without DataKinds - data Vec :: Nat -> Type -> Type - - (The ``-Wdata-kinds-tc`` warning was introduced in GHC 9.10 as part of a fix - for an accidental oversight in which programs like the one above were - mistakenly accepted without the use of :extension:`DataKinds`.) - -* The :extension:`MonadComprehensions` extension now implies :extension:`ParallelListComp` as was originally intended (see `Monad Comprehensions https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/monad_comprehensions...`_). - -* In accordance with `GHC Proposal #281 https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0281-vi...`_, - section 4.7 "Data constructors", the :extension:`RequiredTypeArguments` - extension now allows visible forall in types of data constructors - (:ghc-ticket:`25127`). The following declaration is now accepted by GHC: - - :: - - data T a where - Typed :: forall a -> a -> T a - - See :ref:`visible-forall-in-gadts` for details. - -Compiler -~~~~~~~~ - -- An improved error message is introduced to refer users to the heap-controlling flags of the RTS when there is a heap overflow during compilation. (#25198) - -- The kind checker now does a better job of finding type family instances for - use in the kinds of other declarations in the same module. This fixes a number - of tickets: - :ghc-ticket:`12088`, :ghc-ticket:`12239`, :ghc-ticket:`14668`, :ghc-ticket:`15561`, - :ghc-ticket:`16410`, :ghc-ticket:`16448`, :ghc-ticket:`16693`, :ghc-ticket:`19611`, - :ghc-ticket:`20875`, :ghc-ticket:`21172`, :ghc-ticket:`22257`, :ghc-ticket:`25238`, - :ghc-ticket:`25834`. - -- The compiler no longer accepts invalid ``type`` namespace specifiers in - subordinate import lists (:ghc-ticket:`22581`). - -- A new flag, :ghc-flag:`-Wuseless-specialisations`, controls warnings emitted when GHC - determines that a SPECIALISE pragma would have no effect. - -- A new flag, :ghc-flag:`-Wrule-lhs-equalities`, controls warnings emitted for RULES - whose left-hand side attempts to quantify over equality constraints that - previous GHC versions accepted quantifying over. GHC will now drop such RULES, - emitting a warning message controlled by this flag. - - This warning is intended to give visibility to the fact that the RULES that - previous GHC versions generated in such circumstances could never fire. - -- A new flag, :ghc-flag:`-Wunusable-unpack-pragmas`, controls warnings emitted - when GHC is unable to unpack a data constructor field annotated by the - ``{-# UNPACK #-}`` pragma. - - Previous GHC versions issued this warning unconditionally. Now it is possible - to disable it with ``-Wno-unusable-unpack-pragmas`` or turn it into an error - with ``-Werror=unusable-unpack-pragmas``. - -- Introduce a new warning :ghc-flag:`-Wpattern-namespace-specifier` to detect - uses of the now deprecated ``pattern`` namespace specifier in import/export - lists. See `GHC Proposal #581, section 2.3 https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0581-na...`_. - -- Code coverage (:ghc-flag:`-fhpc`) now treats uses of record fields via - :extension:`RecordWildCards` or :extension:`NamedFieldPuns` as if the fields - were accessed using the generated record selector functions, marking the fields - as covered in coverage reports (:ghc-ticket:`17834`). - -- SIMD support in the X86 native code generator has been extended with 128-bit - integer operations. Also, ``shuffleFloatX4#`` and ``shuffleDoubleX2#`` no longer - require ``-mavx``. - -- JSON diagnostics produced with (:ghc-flag:`-fdiagnostics-as-json`) now - include the `rendered` diagnostics message, in the exact same format as what - GHC would have produced without -fdiagnostics-as-json (including ANSI escape - sequences). - -GHCi -~~~~ - -- :ghci-cmd:`:info` now outputs type declarations with @-binders that are - considered semantically significant. See the documentation for :ghci-cmd:`:info` - itself for a more detailed explanation. - -- GHCi errors and warnings now have their own numeric error codes that are - displayed alongside the error. - -Runtime system -~~~~~~~~~~~~~~ - -- Add new runtime flag :rts-flag:`--optimistic-linking` which instructs the - runtime linker to continue in the presence of unknown symbols. By default this - flag is not passed, preserving previous behavior. - -Cmm -~~~ - -``base`` library -~~~~~~~~~~~~~~~~ - -``ghc-prim`` library -~~~~~~~~~~~~~~~~~~~~ - -``ghc`` library -~~~~~~~~~~~~~~~ - -* The `UnknownDiagnostic` constructor now takes an additional type argument - for the type of hints corresponding to the diagnostic, and an additional - value-level argument used for existential wrapping of the hints of the inner - diagnostic. - -* Changes to the HPT and HUG interface: - - - `addToHpt` and `addListToHPT` were moved from `GHC.Unit.Home.ModInfo` to `GHC.Unit.Home.PackageTable` and deprecated in favour of `addHomeModInfoToHpt` and `addHomeModInfosToHpt`. - - `UnitEnvGraph` and operations `unitEnv_lookup_maybe`, `unitEnv_foldWithKey, `unitEnv_singleton`, `unitEnv_adjust`, `unitEnv_insert`, `unitEnv_new` were moved from `GHC.Unit.Env` to `GHC.Unit.Home.Graph`. - - The HomePackageTable (HPT) is now exported from `GHC.Unit.Home.PackageTable`, - and is now backed by an IORef to avoid by construction very bad memory leaks. - This means the API to the HPT now is for the most part in IO. For instance, - `emptyHomePackageTable` and `addHomeModInfoToHpt` are now in IO. - - `mkHomeUnitEnv` was moved to `GHC.Unit.Home.PackageTable`, and now takes two - extra explicit arguments. To restore previous behaviour, pass `emptyUnitState` - and `Nothing` as the first two arguments additionally. - - `hugElts` was removed. Users should prefer `allUnits` to get the keys of the - HUG (the typical use case), or `traverse` or `unitEnv_foldWithKey` in other - cases. - -* Changes to `Language.Haskell.Syntax.Expr` - - - The `ParStmtBlock` list argument of the `ParStmt` constructor of `StmtLR` is now `NonEmpty`. - -* As part of the implementation of `GHC proposal 493 https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0493-sp...`_, - the `SpecSig` constructor of `Sig` has been deprecated. It is replaced by - the constructor `SpecSigE` which supports expressions at the head, rather than - a lone variable. - -``ghc-heap`` library -~~~~~~~~~~~~~~~~~~~~ - -* The functions `getClosureInfoTbl_maybe`, `getClosureInfoTbl`, - `getClosurePtrArgs` and `getClosurePtrArgs_maybe` have been added to allow - reading of the relevant Closure attributes without reliance on incomplete - selectors. - -``ghc-experimental`` library -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -- ``ghc-experimental`` now exposes ``GHC.RTS.Flags`` and ``GHC.Stats`` as - ``GHC.RTS.Flags.Experimental`` and ``GHC.Stats.Experimental``. These are - *also* exposed in ``base``, however the ``base`` versions will be deprecated as - part of the split base project. See `CLC proposal 289 - https://github.com/haskell/core-libraries-committee/issues/289`__. - Downstream consumers of these flags are encouraged to migrate to the - ``ghc-experimental`` versions. - - - -``template-haskell`` library -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -- As part of the implementation of `GHC proposal 493 https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0493-sp...`_, - the ``SpecialiseP`` constructor of the Template Haskell ``Pragma`` type, as - well as the helpers ``pragSpecD`` and ``pragSpecInlD``, have been deprecated. - - They are replaced, respectively, by ``SpecialiseEP``, ``pragSpecED`` and - ``pragSpecInlED``. - -Included libraries -~~~~~~~~~~~~~~~~~~ - -The package database provided with this distribution also contains a number of -packages other than GHC itself. See the changelogs provided with these packages -for further change information. - -.. ghc-package-list:: - - libraries/array/array.cabal: Dependency of ``ghc`` library - libraries/base/base.cabal: Core library - libraries/binary/binary.cabal: Dependency of ``ghc`` library - libraries/bytestring/bytestring.cabal: Dependency of ``ghc`` library - libraries/Cabal/Cabal/Cabal.cabal: Dependency of ``ghc-pkg`` utility - libraries/Cabal/Cabal-syntax/Cabal-syntax.cabal: Dependency of ``ghc-pkg`` utility - libraries/containers/containers/containers.cabal: Dependency of ``ghc`` library - libraries/deepseq/deepseq.cabal: Dependency of ``ghc`` library - libraries/directory/directory.cabal: Dependency of ``ghc`` library - libraries/exceptions/exceptions.cabal: Dependency of ``ghc`` and ``haskeline`` library - libraries/filepath/filepath.cabal: Dependency of ``ghc`` library - compiler/ghc.cabal: The compiler itself - libraries/ghci/ghci.cabal: The REPL interface - libraries/ghc-boot/ghc-boot.cabal: Internal compiler library - libraries/ghc-boot-th/ghc-boot-th.cabal: Internal compiler library - libraries/ghc-compact/ghc-compact.cabal: Core library - libraries/ghc-heap/ghc-heap.cabal: GHC heap-walking library - libraries/ghc-prim/ghc-prim.cabal: Core library - utils/haddock/haddock-api/haddock-api.cabal: Dependency of ``haddock`` executable - utils/haddock/haddock-library/haddock-library.cabal: Dependency of ``haddock`` executable - libraries/haskeline/haskeline.cabal: Dependency of ``ghci`` executable - libraries/hpc/hpc.cabal: Dependency of ``hpc`` executable - libraries/integer-gmp/integer-gmp.cabal: Core library - libraries/mtl/mtl.cabal: Dependency of ``Cabal`` library - libraries/parsec/parsec.cabal: Dependency of ``Cabal`` library - libraries/pretty/pretty.cabal: Dependency of ``ghc`` library - libraries/process/process.cabal: Dependency of ``ghc`` library - libraries/stm/stm.cabal: Dependency of ``haskeline`` library - libraries/template-haskell/template-haskell.cabal: Core library - libraries/terminfo/terminfo.cabal: Dependency of ``haskeline`` library - libraries/text/text.cabal: Dependency of ``Cabal`` library - libraries/time/time.cabal: Dependency of ``ghc`` library - libraries/transformers/transformers.cabal: Dependency of ``ghc`` library - libraries/unix/unix.cabal: Dependency of ``ghc`` library - libraries/Win32/Win32.cabal: Dependency of ``ghc`` library - libraries/xhtml/xhtml.cabal: Dependency of ``haddock`` executable - libraries/os-string/os-string.cabal: Dependency of ``filepath`` library - libraries/file-io/file-io.cabal: Dependency of ``directory`` library ===================================== docs/users_guide/9.16.1-notes.rst ===================================== @@ -0,0 +1,99 @@ +.. _release-9-16-1: + +Version 9.16.1 +============== + +The significant changes to the various parts of the compiler are listed in the +following sections. See the `migration guide +https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.16`_ on the GHC Wiki +for specific guidance on migrating programs to this release. + +Language +~~~~~~~~ + +Compiler +~~~~~~~~ + +- Code coverage's (:ghc-flag:`-fhpc`) treatment of record fields now extends + beyond record fields accessed via :extension:`RecordWildCards` and + :extension:`NamedFieldPuns`, and also handles access to nested record fields. + That is, in a pattern such as ``Foo{bar = Bar{baz = b}}`` both ``bar`` and + ``baz`` will now be marked as covered if ``b`` is evaluated. Note that this + currently only works when record fields (or values contained within them) are + bound to variables. The very similar pattern ``Foo{bar = Bar{baz = 42}}`` + will will not yet mark ``bar`` or ``baz`` as covered. + +GHCi +~~~~ + +Runtime system +~~~~~~~~~~~~~~ + +Cmm +~~~ + +``base`` library +~~~~~~~~~~~~~~~~ + +``ghc-prim`` library +~~~~~~~~~~~~~~~~~~~~ + +``ghc`` library +~~~~~~~~~~~~~~~ + +``ghc-heap`` library +~~~~~~~~~~~~~~~~~~~~ + +``ghc-experimental`` library +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``template-haskell`` library +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Included libraries +~~~~~~~~~~~~~~~~~~ + +The package database provided with this distribution also contains a number of +packages other than GHC itself. See the changelogs provided with these packages +for further change information. + +.. ghc-package-list:: + + libraries/array/array.cabal: Dependency of ``ghc`` library + libraries/base/base.cabal: Core library + libraries/binary/binary.cabal: Dependency of ``ghc`` library + libraries/bytestring/bytestring.cabal: Dependency of ``ghc`` library + libraries/Cabal/Cabal/Cabal.cabal: Dependency of ``ghc-pkg`` utility + libraries/Cabal/Cabal-syntax/Cabal-syntax.cabal: Dependency of ``ghc-pkg`` utility + libraries/containers/containers/containers.cabal: Dependency of ``ghc`` library + libraries/deepseq/deepseq.cabal: Dependency of ``ghc`` library + libraries/directory/directory.cabal: Dependency of ``ghc`` library + libraries/exceptions/exceptions.cabal: Dependency of ``ghc`` and ``haskeline`` library + libraries/filepath/filepath.cabal: Dependency of ``ghc`` library + compiler/ghc.cabal: The compiler itself + libraries/ghci/ghci.cabal: The REPL interface + libraries/ghc-boot/ghc-boot.cabal: Internal compiler library + libraries/ghc-boot-th/ghc-boot-th.cabal: Internal compiler library + libraries/ghc-compact/ghc-compact.cabal: Core library + libraries/ghc-heap/ghc-heap.cabal: GHC heap-walking library + libraries/ghc-prim/ghc-prim.cabal: Core library + utils/haddock/haddock-api/haddock-api.cabal: Dependency of ``haddock`` executable + utils/haddock/haddock-library/haddock-library.cabal: Dependency of ``haddock`` executable + libraries/haskeline/haskeline.cabal: Dependency of ``ghci`` executable + libraries/hpc/hpc.cabal: Dependency of ``hpc`` executable + libraries/integer-gmp/integer-gmp.cabal: Core library + libraries/mtl/mtl.cabal: Dependency of ``Cabal`` library + libraries/parsec/parsec.cabal: Dependency of ``Cabal`` library + libraries/pretty/pretty.cabal: Dependency of ``ghc`` library + libraries/process/process.cabal: Dependency of ``ghc`` library + libraries/stm/stm.cabal: Dependency of ``haskeline`` library + libraries/template-haskell/template-haskell.cabal: Core library + libraries/terminfo/terminfo.cabal: Dependency of ``haskeline`` library + libraries/text/text.cabal: Dependency of ``Cabal`` library + libraries/time/time.cabal: Dependency of ``ghc`` library + libraries/transformers/transformers.cabal: Dependency of ``ghc`` library + libraries/unix/unix.cabal: Dependency of ``ghc`` library + libraries/Win32/Win32.cabal: Dependency of ``ghc`` library + libraries/xhtml/xhtml.cabal: Dependency of ``haddock`` executable + libraries/os-string/os-string.cabal: Dependency of ``filepath`` library + libraries/file-io/file-io.cabal: Dependency of ``directory`` library ===================================== docs/users_guide/release-notes.rst ===================================== @@ -4,4 +4,4 @@ Release notes .. toctree:: :maxdepth: 1 - 9.14.1-notes + 9.16.1-notes ===================================== testsuite/tests/hpc/recsel/recsel.hs ===================================== @@ -10,7 +10,8 @@ import Trace.Hpc.Tix import Trace.Hpc.Reflect data Foo = Foo { fooA, fooB, fooC, fooD, fooE, fooF, fooG, fooH, fooI - , fooJ, fooK, fooL, fooM, fooN, fooO :: Int } + , fooJ, fooK, fooL, fooM, fooN, fooO :: Int + , fooP, fooQ :: Maybe Int } data Bar = Bar { barFoo :: Foo } fAB Foo{..} = fooA + fooB @@ -35,14 +36,17 @@ fL = runIdentity . runKleisli (proc f -> do fM f | Foo{..} <- f = fooM fN f = fooN f fO = runIdentity . runKleisli (proc Foo{..} -> returnA -< fooO) +fP Foo{fooP = Just x} = x +fP _ = 0 +fQ Foo{fooQ = Just 42} = 1 recSel (n, TopLevelBox [s]) | any (`isPrefixOf` s) ["foo", "bar"] = Just (n, s) recSel _ = Nothing main = do - let foo = Foo 42 23 0 1 2 3 4 5 6 7 0xaffe 9 10 11 12 + let foo = Foo 42 23 0 1 2 3 4 5 6 7 0xaffe 9 10 11 12 (Just 13) (Just 42) mapM_ (print . ($ foo)) - [fAB, fC, fD False, fE . Bar, fF, fG, fH, fI, fJ, fK, fL, fM, fN, fO] + [fAB, fC, fD False, fE . Bar, fF, fG, fH, fI, fJ, fK, fL, fM, fN, fO, fP, fQ] (Mix _ _ _ _ mixs) <- readMix [".hpc"] (Left "Main") let sels = mapMaybe recSel . zip [0..] $ map snd mixs (Tix [TixModule "Main" _ _ tix]) <- examineTix ===================================== testsuite/tests/hpc/recsel/recsel.stdout ===================================== @@ -12,13 +12,15 @@ 10 11 12 -(0,"barFoo") +13 +1 +(1,"barFoo") (1,"fooA") (1,"fooB") (1,"fooC") (0,"fooD") (1,"fooE") -(0,"fooF") +(1,"fooF") (1,"fooG") (1,"fooH") (1,"fooI") @@ -28,3 +30,5 @@ (1,"fooM") (1,"fooN") (1,"fooO") +(1,"fooP") +(0,"fooQ") View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0434af813cd5aa629ef7566cd267d7c... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0434af813cd5aa629ef7566cd267d7c... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)