
#15957: Provide warning for when RecordWildCards LHS {..} doesn't bind anything. -------------------------------------+------------------------------------- Reporter: Fuuzetsu | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Fuuzetsu): To be clear, the behaviour we would like to see is a warning whenever the {..} adds no new used bindings into the environment. {{{#!haskell data P = P { x :: Int, y :: Int } f1 P{..} = 1 + 3 -- nothing bound is used f2 P{x, ..} = x + 3 -- y bound but not used f3 P{x, y, ..} = x + y -- no bindings left, i.e. no new useful bindings introduced g1 P{..} = x + 3 -- x from .. is used g2 P{x, ..} = x + y -- y from .. is used, even if it's in a weird style }}} f1, f2 and f3 should warn, g1 and g2 should not. I actually gave this a go myself but the way it was programmed was a bit too much for me for a quick hack. The way it is done now is that {{{..}}} is expanded into the bindings and those bindings are tagged with "don't warn if unusued" flag. Instead it should warn, but only if none of the {{{..}}}-bound names is used. Depending on how it's done, we should be careful to produce only a single warning &c. I imagine any solution is not too hard for anyone used to the codebase. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15957#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler