[GHC] #15308: Error message prints explicit kinds when it shouldn't
#15308: Error message prints explicit kinds when it shouldn't -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 (Type checker) | Keywords: TypeInType | Operating System: Unknown/Multiple Architecture: | Type of failure: Poor/confusing Unknown/Multiple | error message Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- When compiled, this program: {{{#!hs {-# LANGUAGE GADTs #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeInType #-} {-# OPTIONS_GHC -fno-print-explicit-kinds #-} module Bug where import Data.Kind data Foo (a :: Type) :: forall b. (a -> b -> Type) -> Type where MkFoo :: Foo a f f :: Foo a f -> String f = show }}} Gives the following error: {{{ $ /opt/ghc/8.4.3/bin/ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:13:5: error: • No instance for (Show (Foo a b f)) arising from a use of ‘show’ • In the expression: show In an equation for ‘f’: f = show | 13 | f = show | ^^^^ }}} This error message is slightly incorrect, however. In "`No instance for (Show (Foo a b f))`", it claims that `Foo` has three visible type parameters, but it only has two. (I've even made sure to enable `-fno- print-explicit-kinds` at the type to ensure that the invisible `b` kind shouldn't get printed, but it was anyway.) This is a regression that was apparently introduced between GHC 8.0 and 8.2, since in GHC 8.0.2, it prints the correct thing: {{{ $ /opt/ghc/8.0.2/bin/ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:13:5: error: • No instance for (Show (Foo a f)) arising from a use of ‘show’ • In the expression: show In an equation for ‘f’: f = show }}} But it does not in GHC 8.2.1: {{{ $ /opt/ghc/8.2.1/bin/ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:13:5: error: • No instance for (Show (Foo a b f)) arising from a use of ‘show’ • In the expression: show In an equation for ‘f’: f = show | 13 | f = show | ^^^^ }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15308> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15308: Error message prints explicit kinds when it shouldn't -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.4.3 checker) | Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4891 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D4891 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15308#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15308: Error message prints explicit kinds when it shouldn't -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.4.3 checker) | Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4891 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"3d002087dce9c61932dd17047902baa83581f4df/ghc" 3d00208/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="3d002087dce9c61932dd17047902baa83581f4df" Add commnent about binder order ...provoked by Trac #15308 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15308#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15308: Error message prints explicit kinds when it shouldn't -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.4.3 checker) | Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4891 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ryan Scott <ryan.gl.scott@…>): In [changeset:"93b7ac8d73885369f61f6eb6147352d45de4e957/ghc" 93b7ac8/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="93b7ac8d73885369f61f6eb6147352d45de4e957" Fix #15308 by suppressing invisble args more rigorously Summary: There was a buglet in `stripInvisArgs` (which is part of the pretty-printing pipeline for types) in which only invisble arguments which came before any visible arguments would be suppressed, but any invisble arguments that came //after// visible ones would still be printed, even if `-fprint-explicit-kinds` wasn't enabled. The fix is simple: make `stripInvisArgs` recursively process the remaining types even after a visible argument is encountered. Test Plan: make test TEST=T15308 Reviewers: goldfire, bgamari Reviewed By: bgamari Subscribers: simonpj, rwbarton, thomie, carter GHC Trac Issues: #15308 Differential Revision: https://phabricator.haskell.org/D4891 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15308#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15308: Error message prints explicit kinds when it shouldn't -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: merge Priority: normal | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.4.3 checker) | Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | dependent/should_fail/T15308 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4891 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * testcase: => dependent/should_fail/T15308 * status: patch => merge -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15308#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15308: Error message prints explicit kinds when it shouldn't -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.4.3 checker) | Resolution: fixed | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | dependent/should_fail/T15308 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4891 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: comment:2 merged with 423961132e9d19850e290b38df15006c607744d1. comment:3 merged with 9bcbb222e5b701277ef315c5c4aa76b23f578d0c. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15308#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC