[GHC] #13919: Incorrect unused top binding warning when interacting with GHC.Generics

#13919: Incorrect unused top binding warning when interacting with GHC.Generics -------------------------------------+------------------------------------- Reporter: Taneb | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Incorrect Unknown/Multiple | error/warning at compile-time Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The program {{{#!hs {-# LANGUAGE DeriveGeneric #-} module Main (main) where import Data.Aeson import GHC.Generics data Foo = Foo {bar :: String} deriving Generic instance ToJSON Foo where toJSON = genericToJSON defaultOptions main :: IO () main = print (toJSON (Foo "hello")) }}} emits the warning {{{ UTB.hs:7:17: warning: [-Wunused-top-binds] Defined but not used: ‘bar’ }}} but removing that binding changes the behaviour of the program, as the above prints {{{ Object (fromList [("bar",String "hello")]) }}} but {{{#!hs {-# LANGUAGE DeriveGeneric #-} module Main (main) where import Data.Aeson import GHC.Generics data Foo = Foo String deriving Generic instance ToJSON Foo where toJSON = genericToJSON defaultOptions main :: IO () main = print (toJSON (Foo "hello")) }}} prints {{{ String "hello" }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13919 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13919: Incorrect unused top binding warning when interacting with GHC.Generics -------------------------------------+------------------------------------- Reporter: Taneb | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Generics Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: #1954 | Differential Rev(s): Phab:D3704 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * keywords: => Generics * status: new => patch * differential: => Phab:D3704 * related: => #1954 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13919#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13919: Incorrect unused top binding warning when interacting with GHC.Generics
-------------------------------------+-------------------------------------
Reporter: Taneb | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords: Generics
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect | Unknown/Multiple
error/warning at compile-time | Test Case:
Blocked By: | Blocking:
Related Tickets: #1954 | Differential Rev(s): Phab:D3704
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#13919: Incorrect unused top binding warning when interacting with GHC.Generics -------------------------------------+------------------------------------- Reporter: Taneb | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: Generics Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: #1954 | Differential Rev(s): Phab:D3704 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed * milestone: => 8.4.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13919#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC