Skip to content
  • sheaf's avatar
    0f2241e9
    Propagate long distance info to guarded let binds · 0f2241e9
    sheaf authored and Marge Bot's avatar Marge Bot committed
    This commit 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'.
    
    Fixes #25749
    0f2241e9
    Propagate long distance info to guarded let binds
    sheaf authored and Marge Bot's avatar Marge Bot committed
    This commit 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'.
    
    Fixes #25749
Loading