Pmc: Consider long-distance information when warning about OverloadedRecordDot
Consider
{-# LANGUAGE GADTs, OverloadedRecordDot #-}
module Lib where
data T a where
T1 :: T Int
T2 :: {sel :: Int} -> T Bool
T3 :: T Bool
f :: T Bool -> Int
f x = x.sel -- warn
data Dot = No | Yes {sel2 :: Int}
ldiDot :: Dot -> Int
ldiDot No = 0
ldiDot d = d.sel2 -- do not warn
We should warn about f
, but not about ldiDot
, because in the latter case we will never select on No
because of the ambient pattern-match.
Currently, we warn about both occurrences, a shortcoming of the current approach to -Wincomplete-record-selectors.