Re-instate -Wincomplete-record-updates
Commit e74fc066 refactored the handling of record updates to use the HsExpanded mechanism. This meant that the pattern matching inherent to a record update was considered to be "generated code", and thus we stopped emitting "incomplete record update" warnings entirely. This commit changes the "data Origin = Source | Generated" datatype, adding a field to the Generated constructor to indicate whether we still want to perform pattern-match checking. We also have to do a bit of plumbing with HsCase, to record that the HsCase arose from an HsExpansion of a RecUpd, so that the error message continues to mention record updates as opposed to a generic "incomplete pattern matches in case" error. Finally, this patch also changes the way we handle inaccessible code warnings. Commit e74fc066 was also a regression in this regard, as we were emitting "inaccessible code" warnings for case statements spuriously generated when desugaring a record update (remember: the desugaring mechanism happens before typechecking; it thus can't take into account e.g. GADT information in order to decide which constructors to include in the RHS of the desugaring of the record update). We fix this by changing the mechanism through which we disable inaccessible code warnings: we now check whether we are in generated code in GHC.Tc.Utils.TcMType.newImplication in order to determine whether to emit inaccessible code warnings. Fixes #23520 Updates haddock submodule, to avoid incomplete record update warnings
Showing
- compiler/GHC/Hs/Expr.hs 6 additions, 7 deletionscompiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Utils.hs 6 additions, 5 deletionscompiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Arrows.hs 3 additions, 3 deletionscompiler/GHC/HsToCore/Arrows.hs
- compiler/GHC/HsToCore/Errors/Ppr.hs 2 additions, 2 deletionscompiler/GHC/HsToCore/Errors/Ppr.hs
- compiler/GHC/HsToCore/Errors/Types.hs 4 additions, 4 deletionscompiler/GHC/HsToCore/Errors/Types.hs
- compiler/GHC/HsToCore/Expr.hs 4 additions, 3 deletionscompiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/GuardedRHSs.hs 3 additions, 3 deletionscompiler/GHC/HsToCore/GuardedRHSs.hs
- compiler/GHC/HsToCore/Match.hs 11 additions, 11 deletionscompiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Match.hs-boot 4 additions, 4 deletionscompiler/GHC/HsToCore/Match.hs-boot
- compiler/GHC/HsToCore/Match/Constructor.hs 2 additions, 2 deletionscompiler/GHC/HsToCore/Match/Constructor.hs
- compiler/GHC/HsToCore/Monad.hs 1 addition, 1 deletioncompiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/Pmc.hs 1 addition, 1 deletioncompiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Pmc/Utils.hs 13 additions, 14 deletionscompiler/GHC/HsToCore/Pmc/Utils.hs
- compiler/GHC/HsToCore/Utils.hs 1 addition, 1 deletioncompiler/GHC/HsToCore/Utils.hs
- compiler/GHC/Iface/Ext/Ast.hs 1 addition, 1 deletioncompiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Rename/Expr.hs 1 addition, 1 deletioncompiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/Utils.hs 2 additions, 2 deletionscompiler/GHC/Rename/Utils.hs
- compiler/GHC/Tc/Deriv/Generate.hs 3 additions, 3 deletionscompiler/GHC/Tc/Deriv/Generate.hs
- compiler/GHC/Tc/Gen/Expr.hs 3 additions, 2 deletionscompiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Splice.hs 1 addition, 1 deletioncompiler/GHC/Tc/Gen/Splice.hs
Loading
Please register or sign in to comment