Pmc: Implement `considerAccessible` (#18610)
Consider (T18610
):
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
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.
I also fixed a small bug in extendSDFM
in a separate commit that should have ample test coverage through T18610
.
Fixes #18610 (closed) and #19228 (closed).