[GHC] #14094: DeriveAnyClass doesn't warn about unimplemented type families
#14094: DeriveAnyClass doesn't warn about unimplemented type families -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.2.1 Keywords: deriving | 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: -------------------------------------+------------------------------------- Consider this code: {{{#!hs {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -Wall #-} module Bug where class C a where type T a data D a m :: a instance C Int deriving instance C Bool }}} Neither `C` instance implements any of its type families or methods. However, the manual `C Int` instance and the derived `C Bool` instance give different warnings: {{{ GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Bug ( Bug.hs, interpreted ) Bug.hs:12:1: warning: [-Wmissing-methods] • No explicit associated type or default declaration for ‘T’ • In the instance declaration for ‘C Int’ | 12 | instance C Int | ^^^^^^^^^^^^^^ Bug.hs:12:1: warning: [-Wmissing-methods] • No explicit associated type or default declaration for ‘D’ • In the instance declaration for ‘C Int’ | 12 | instance C Int | ^^^^^^^^^^^^^^ Bug.hs:12:10: warning: [-Wmissing-methods] • No explicit implementation for ‘m’ • In the instance declaration for ‘C Int’ | 12 | instance C Int | ^^^^^ Bug.hs:13:1: warning: [-Wmissing-methods] • No explicit implementation for ‘m’ • In the instance declaration for ‘C Bool’ | 13 | deriving instance C Bool | ^^^^^^^^^^^^^^^^^^^^^^^^ }}} Notice that the `C Int` instance warns about the lack of an implementation for `T` and `D`, as expected. However, the derived `C Bool` instance does not. It only warns about `m`! -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14094> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14094: DeriveAnyClass doesn't warn about unimplemented type families -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: deriving 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: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * owner: (none) => RyanGlScott -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14094#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14094: DeriveAnyClass doesn't warn about unimplemented type families -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: deriving 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): Phab:D3828 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D3828 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14094#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14094: DeriveAnyClass doesn't warn about unimplemented type families -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: deriving 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): Phab:D3828 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ryan Scott <ryan.gl.scott@…>): In [changeset:"3f05e5f6becc2f7174898726b6f027105b12a780/ghc" 3f05e5f6/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="3f05e5f6becc2f7174898726b6f027105b12a780" Don't suppress unimplemented type family warnings with DeriveAnyClass Summary: For some asinine reason, we were suppressing warnings when deriving associated type family instances with `DeriveAnyClass`. That seems like a bad idea. Let's not do that. Along the way, I noticed that the error contexts associated with these newly emitted warnings were less than ideal, so I did some minor refactoring to improve the story there. Fixes #14094 Test Plan: ./validate Reviewers: bgamari, austin Subscribers: rwbarton, thomie GHC Trac Issues: #14094 Differential Revision: https://phabricator.haskell.org/D3828 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14094#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14094: DeriveAnyClass doesn't warn about unimplemented type families -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.2.1 Resolution: fixed | Keywords: deriving Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect | Test Case: error/warning at compile-time | deriving/should_compile/T14094 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3828 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * testcase: => deriving/should_compile/T14094 * status: patch => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14094#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC