Skip to content

Propagate long distance info to guarded let binds

sheaf requested to merge sheaf/ghc:T25749 into master

This MR ensures that we propagate the enclosing long distance information to let bindings inside guards, in order to get accurate pattern-match checking warnings, in particular incomplete record selector warnings.

Example:

data D = K0 | K1 { fld :: Int }
f :: D -> Int
f d@(K1 {})
  | let i = fld d
  = i
f _ = 3

We now correctly recognise that the field selector fld cannot fail, due to the outer pattern match which guarantees that the value d has the field fld.

Merge request reports

Loading