[GHC] #11623: Wrong error message for type family definition that is wrong in multiple ways
#11623: Wrong error message for type family definition that is wrong in multiple ways -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Type: bug | Status: new Priority: low | Milestone: Component: Compiler | Version: 8.1 (Type checker) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{ GHCi, version 8.1.20160212: http://www.haskell.org/ghc/ :? for help Prelude> :set -XTypeFamilies Prelude> type family T where { Maybe T = Int } <interactive>:2:23: error: • Too many parameters to T: T is unexpected; expected only no parameters • In the type family declaration for ‘T’ }}} This error message is wrong ("Too many parameters to `T`"). Seems like GHC checks whether the equation `Maybe T = Int` has the right number of arguments before it checks whether it is actually headed by `T`. Then the error message is worded in a way that assumes the instance head actually was `T`. The 7.10 error message was better in this regard: {{{ <interactive>:3:23: Number of parameters must match family declaration; expected 0 In the type family declaration for ‘T’ }}} but it would be even better to generate the error below (that is generated once the number of arguments is correct) for the original program: {{{ Prelude> type family T a where { Maybe (T ()) = Int } <interactive>:5:25: error: • Mismatched type name in type family instance. Expected: T Actual: Maybe • In the type family declaration for ‘T’ }}} We should generate that error before kind-checking the definition too. I don't really understand the difference between these two cases though, so maybe my guess is wrong. {{{ Prelude> type family T where { T () = Int } <interactive>:10:23: error: • Too many parameters to T: () is unexpected; expected only no parameters • In the type family declaration for ‘T’ Prelude> type family T :: * -> * where { T () = Int } <interactive>:11:33: error: • Number of parameters must match family declaration; expected 0 • In the equations for closed type family ‘T’ In the type family declaration for ‘T’ }}} (As an aside, "expected only no parameters" is awkward, if there is some legitimate way to generate this message. It should just be "expected no parameters".) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11623> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11623: Wrong error message for type family definition that is wrong in multiple ways -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: rdragon Type: bug | Status: new Priority: low | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by rdragon): * owner: => rdragon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11623#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11623: Wrong error message for type family definition that is wrong in multiple ways -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: rdragon Type: bug | Status: new Priority: low | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2089 Wiki Page: | -------------------------------------+------------------------------------- Changes (by rdragon): * differential: => Phab:D2089 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11623#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11623: Wrong error message for type family definition that is wrong in multiple ways -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: rdragon Type: bug | Status: merge Priority: low | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2089 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => merge -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11623#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11623: Wrong error message for type family definition that is wrong in multiple ways -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: rdragon Type: bug | Status: merge Priority: low | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2089 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: => 8.0.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11623#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11623: Wrong error message for type family definition that is wrong in multiple ways -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: rdragon Type: bug | Status: merge Priority: low | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2089 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"46e8f199e4d3baffa306a40082fbc2fce67f779f/ghc" 46e8f199/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="46e8f199e4d3baffa306a40082fbc2fce67f779f" Fix a closed type family error message Now we check whether a closed type family's equation is headed with the correct type before we kind-check the equation. Also, instead of "expected only no parameters" we now generate the message "expected no parameters". Fixes #11623. Reviewers: simonpj, austin, bgamari Reviewed By: simonpj, bgamari Subscribers: simonpj, goldfire, thomie Differential Revision: https://phabricator.haskell.org/D2089 GHC Trac Issues: #11623 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11623#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11623: Wrong error message for type family definition that is wrong in multiple ways -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: rdragon Type: bug | Status: closed Priority: low | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.1 checker) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2089 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-8.0` as cd35e860d1e709868c6005c8280fca95fe3dd431. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11623#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC