Pmc: Implement `considerAccessible` (#18610)
Consider (`T18610`): ```hs f :: Bool -> Int f x = case (x, x) of (True, True) -> 1 (False, False) -> 2 (True, False) -> 3 -- Warning: Redundant ``` The third clause will be flagged as redundant. Nevertheless, the programmer might intend to keep the clause in order to avoid bitrot. After this patch, the programmer can write ```hs g :: Bool -> Int g x = case (x, x) of (True, True) -> 1 (False, False) -> 2 (True, False) | GHC.Exts.considerAccessible -> 3 -- No warning ``` And won't be bothered any longer. See also `Note [considerAccessible]` and the updated entries in the user's guide. Fixes #18610 and #19228.
Showing
- compiler/GHC/Builtin/Names.hs 11 additions, 11 deletionscompiler/GHC/Builtin/Names.hs
- compiler/GHC/HsToCore/Pmc.hs 4 additions, 6 deletionscompiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Pmc/Check.hs 81 additions, 0 deletionscompiler/GHC/HsToCore/Pmc/Check.hs
- docs/users_guide/9.2.1-notes.rst 12 additions, 5 deletionsdocs/users_guide/9.2.1-notes.rst
- docs/users_guide/using-warnings.rst 28 additions, 0 deletionsdocs/users_guide/using-warnings.rst
- libraries/base/GHC/Exts.hs 27 additions, 3 deletionslibraries/base/GHC/Exts.hs
- testsuite/tests/pmcheck/should_compile/T18610.hs 66 additions, 0 deletionstestsuite/tests/pmcheck/should_compile/T18610.hs
- testsuite/tests/pmcheck/should_compile/T18610.stderr 17 additions, 0 deletionstestsuite/tests/pmcheck/should_compile/T18610.stderr
- testsuite/tests/pmcheck/should_compile/all.T 2 additions, 0 deletionstestsuite/tests/pmcheck/should_compile/all.T
Loading
Please register or sign in to comment