Skip to content

Pmc: Implement `considerAccessible` (#18610)

Sebastian Graf requested to merge wip/T18610 into master

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).

Edited by Sebastian Graf

Merge request reports