Skip to content

Provide warning for when RecordWildCards LHS {..} doesn't bind anything.

Given simple code like

{-# LANGUAGE RecordWildCards #-}
module M (foo) where

data D = D { d1 :: Int, d2 :: Int }

foo :: D -> Int -> Int
foo D{..} x = x + 5

There is no way that I know of to get GHC to warn us that the D{..} in foo is not binding anything at all.

This is very common after refactoring (perhaps foo looked like foo D{..} x = x + d1 + 5 before) and would be great to be able to get a warning about.

Of course it's not dead code as it still forces D to WHNF but if we're using RecordWildCards syntax then it's probably not what we were going for.

Trac metadata
Trac field Value
Version 8.6.2
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information