[GHC] #15957: Provide warning for when RecordWildCards LHS {..} doesn't bind anything.
GHC
ghc-devs at haskell.org
Tue Nov 27 07:24:54 UTC 2018
#15957: Provide warning for when RecordWildCards LHS {..} doesn't bind anything.
-------------------------------------+-------------------------------------
Reporter: Fuuzetsu | Owner: (none)
Type: feature | Status: new
request |
Priority: normal | Milestone: 8.6.3
Component: Compiler | Version: 8.6.2
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Given simple code like
{{{#!haskell
{-# 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.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15957>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list