Skip to content

PMC: suggest in-scope COMPLETE sets when possible

sheaf requested to merge sheaf/ghc:T25115 into master

This MR modifies GHC.HsToCore.Pmc.Solver.generateInhabitingPatterns to prioritise reporting COMPLETE sets in which all of the ConLikes are in scope. This avoids suggesting out of scope constructors when displaying an incomplete pattern match warning, e.g. in

baz :: Ordering -> Int
baz = \case
  EQ -> 5

we prefer:

Patterns of type 'Ordering' not matched:
    LT
    GT

over:

Patterns of type 'Ordering' not matched:
    OutOfScope

where OutOfScope is an out of scope pattern synonym that applies at type Ordering and is the single member of a COMPLETE pragma.

Merge request reports