Spurious incomplete record selector warning in pattern guard
The following program causes a spurious incomplete record selector warning to be emitted:
{-# OPTIONS_GHC -Wincomplete-record-selectors #-}
module T25749 where
data D = K0 | K1 { fld :: Int }
foo :: D -> Int
foo K0 = 3
foo d
| let i = fld d
= i
The application of the record field ‘fld’ may fail for the following constructors: K0
Note that small variations of this program don't cause any warnings, e.g.:
foo K0 = 3
foo d = let i = fld d in i
or
foo K0 = 3
foo d = i
where i = fld d
GHC version: 9.10.1
Edited by sheaf