[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 2 commits: This MR is an implementation of the proposal #516.

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Wed Jul 26 18:42:58 UTC 2023



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


Commits:
631b386a by Bartłomiej Cieślar at 2023-07-26T14:42:51-04:00
This MR is an implementation of the proposal #516.

It adds a warning -Wincomplete-record-selectors for usages of a record
field access function (either a record selector or getField @"rec"),
while trying to silence the warning whenever it can be sure that a constructor
without the record field would not be invoked (which would otherwise cause
the program to fail). For example:

    data T = T1 | T2 {x :: Bool}

    f a = x a -- this would throw an error

    g T1 = True
    g a = x a -- this would not throw an error

    h :: HasField "x" r Bool => r -> Bool
    h = getField @"x"

    j :: T -> Bool
    j = h -- this would throw an error because of the `HasField`
          -- constraint being solved

See the tests DsIncompleteRecSel* and TcIncompleteRecSel for more examples of the warning.
See Note [Detecting incomplete record selectors] in GHC.HsToCore.Expr for implementation details

- - - - -
c6355608 by Arnaud Spiwack at 2023-07-26T14:42:54-04:00
Fix user-facing label in MR template

- - - - -


30 changed files:

- .gitlab/merge_request_templates/Default.md
- compiler/GHC/Core/ConLike.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/HsToCore/Errors/Ppr.hs
- compiler/GHC/HsToCore/Errors/Types.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Pmc/Check.hs
- compiler/GHC/HsToCore/Pmc/Types.hs
- compiler/GHC/HsToCore/Pmc/Utils.hs
- compiler/GHC/IfaceToCore.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Instance/Class.hs
- compiler/GHC/Tc/Solver/Dict.hs
- compiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/TyCl/Utils.hs
- compiler/GHC/Types/Error.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/Id/Info.hs
- compiler/GHC/Types/TyThing.hs
- docs/users_guide/9.10.1-notes.rst
- docs/users_guide/9.8.1-notes.rst
- docs/users_guide/using-warnings.rst
- testsuite/tests/plugins/all.T
- + testsuite/tests/pmcheck/should_compile/DsIncompleteRecSel1.hs
- + testsuite/tests/pmcheck/should_compile/DsIncompleteRecSel1.stderr
- + testsuite/tests/pmcheck/should_compile/DsIncompleteRecSel2.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/702e3410358013be82c82c47237740c4a7d0b533...c6355608317226a0e46c8c70eb707a7e4169bded

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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230726/0277ea63/attachment.html>


More information about the ghc-commits mailing list