[GHC] #16376: GHCi HEAD silently accepts ill-kinded visible type applications with :type
#16376: GHCi HEAD silently accepts ill-kinded visible type applications with :type -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: Component: GHCi | Version: 8.9 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: GHC accepts Unknown/Multiple | invalid program Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- If you try something nonsensical like `id @Maybe` in GHCi 8.6.3, it will be properly rejected: {{{ $ ghci -XTypeApplications GHCi, version 8.6.3: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci λ> :t id @Maybe <interactive>:1:5: error: • Expecting one more argument to ‘Maybe’ Expected a type, but ‘Maybe’ has kind ‘* -> *’ • In the type ‘Maybe’ In the expression: id @Maybe }}} On GHC HEAD, however, this is seemingly accepted! {{{ $ ~/Software/ghc/inplace/bin/ghc-stage2 --interactive -XTypeApplications GHCi, version 8.9.20190224: https://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci λ> :t id @Maybe λ> }}} No error message, just... a newline. Quite bizarre. Even more bizarrely, this phenomenon doesn't appear to happen with `:kind`: {{{ λ> :set -XDataKinds -XPolyKinds λ> type Id (a :: k) = a λ> :k Id @Maybe <interactive>:1:5: error: • Expecting one more argument to ‘Maybe’ Expected a type, but ‘Maybe’ has kind ‘* -> *’ • In the first argument of ‘Id’, namely ‘Maybe’ In the type ‘Id @Maybe’ }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16376> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#16376: GHCi HEAD silently accepts ill-kinded visible type applications with :type -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: Component: GHCi | Version: 8.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by int-index): * cc: int-index (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16376#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#16376: GHCi HEAD silently accepts ill-kinded visible type applications with :type -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: Component: GHCi | Version: 8.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: simonpj (added) Comment: This regression was introduced in commit [https://gitlab.haskell.org/ghc/ghc/commit/5c1f268e2744fab2d36e64c16385899545... 5c1f268e2744fab2d36e64c163858995451d7095] (`Fail fast in solveLocalEqualities`). -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16376#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#16376: GHCi HEAD silently accepts ill-kinded visible type applications with :type -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: Component: GHCi | Version: 8.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Combining this with `-fdefer-type-errors` leads to a panic: {{{ GHCi, version 8.9.20190227: https://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci λ> :set -XTypeApplications -fdefer-type-errors λ> f = id @Maybe <interactive>:2:9: warning: [-Wdeferred-type-errors] • Expecting one more argument to ‘Maybe’ Expected a type, but ‘Maybe’ has kind ‘* -> *’ • In the type ‘Maybe’ In the expression: id @Maybe In an equation for ‘f’: f = id @Maybe ghc-stage2: panic! (the 'impossible' happened) (GHC version 8.9.20190227 for x86_64-unknown-linux): nameModule internal f_a1BS Call stack: CallStack (from HasCallStack): callStackDoc, called at compiler/utils/Outputable.hs:1159:37 in ghc:Outputable pprPanic, called at compiler/basicTypes/Name.hs:249:3 in ghc:Name }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16376#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#16376: GHCi HEAD silently accepts ill-kinded visible type applications with :type -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: Component: GHCi | Version: 8.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): comment:3 reveals another bug: see #16404 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16376#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#16376: GHCi HEAD silently accepts ill-kinded visible type applications with :type -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: highest | Milestone: 8.10.1 Component: GHCi | Version: 8.9 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC accepts | Test Case: invalid program | ghci/scripts/T16376 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * testcase: => ghci/scripts/T16376 * resolution: => fixed * milestone: => 8.10.1 Comment: Fixed in [https://gitlab.haskell.org/ghc/ghc/commit/5be7ad7861c8d39f60b7101fd8d8e816ff... 5be7ad78]. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16376#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#16376: GHCi HEAD silently accepts ill-kinded visible type applications with :type -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: highest | Milestone: 8.10.1 Component: GHCi | Version: 8.9 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC accepts | Test Case: invalid program | ghci/scripts/T16376 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Marge Bot <ben+marge-bot@…>): In [changeset:"5be7ad7861c8d39f60b7101fd8d8e816ff50353a/ghc" 5be7ad78/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="5be7ad7861c8d39f60b7101fd8d8e816ff50353a" Use captureTopConstraints in TcRnDriver calls Trac #16376 showed the danger of failing to report an error that exists only in the unsolved constraints, if an exception is raised (via failM). Well, the commit 5c1f268e (Fail fast in solveLocalEqualities) did just that -- i.e. it found errors in the constraints, and called failM to avoid a misleading cascade. So we need to be sure to call captureTopConstraints to report those insolubles. This was wrong in TcRnDriver.tcRnExpr and in TcRnDriver.tcRnType. As a result the error messages from test T13466 improved slightly, a happy outcome. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16376#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC