[GHC] #15825: Core Lint error from Explicit Foralls Proposal

#15825: Core Lint error from Explicit Foralls Proposal -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- This is using the recent Explicit Foralls Proposal #14268 {{{#!hs {-# Language RankNTypes #-} {-# Language PolyKinds #-} {-# Language KindSignatures #-} {-# Language DataKinds #-} {-# Language FlexibleInstances #-} {-# Options_GHC -dcore-lint #-} type C k = (forall (x::k). *) class X (a :: *) instance forall (a :: C k). X (a :: *) }}} {{{ $ ./inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci /tmp/599_bug.hs GHCi, version 8.7.20181025: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( 599_bug.hs, interpreted ) *** Core Lint errors : in result of Desugar (before optimization) *** <no location info>: warning: In the expression: C:X @ a_a1yJ Kind application error in type ‘a_a1yJ’ Function kind = C k_a1yI Arg kinds = [(x_a1yH, k_a1yG)] Forall: x_a1xE k_a1yI (x_a1yH, k_a1yG) <no location info>: warning: In the expression: C:X @ a_a1xG Kind application error in type ‘a_a1xG’ Function kind = C k_X1xQ Arg kinds = [(x_a1yv, k_a1xF)] Forall: x_a1xE k_X1xQ (x_a1yv, k_a1xF) *** Offending Program *** Rec { $tcX :: TyCon [LclIdX] $tcX = TyCon 6136962148358085538## 2047526523769221729## $trModule (TrNameS "X"#) 0# $krep_a1zH $tc'C:X :: TyCon [LclIdX] $tc'C:X = TyCon 12994509767826319747## 2028070155085790741## $trModule (TrNameS "'C:X"#) 1# $krep_a1zJ $krep_a1zK [InlPrag=NOUSERINLINE[~]] :: KindRep [LclId] $krep_a1zK = $WKindRepVar (I# 0#) $krep_a1zH [InlPrag=NOUSERINLINE[~]] :: KindRep [LclId] $krep_a1zH = KindRepFun krep$* $krep_a1zI $krep_a1zI [InlPrag=NOUSERINLINE[~]] :: KindRep [LclId] $krep_a1zI = KindRepTyConApp $tcConstraint ([] @ KindRep) $krep_a1zJ [InlPrag=NOUSERINLINE[~]] :: KindRep [LclId] $krep_a1zJ = KindRepTyConApp $tcX (: @ KindRep $krep_a1zK ([] @ KindRep)) $trModule :: Module [LclIdX] $trModule = Module (TrNameS "main"#) (TrNameS "Main"#) $fXa [InlPrag=NOUSERINLINE CONLIKE] :: forall k (x :: k) k (a :: C k). X a [LclIdX[DFunId], Unf=DFun: \ (@ k_a1xF) (@ (x_a1yv :: k_a1xF)) (@ k_a1xF) (@ (a_a1xG :: C k_a1xF)) -> C:X TYPE: a_a1xG] $fXa = \ (@ k_a1yG) (@ (x_a1yH :: k_a1yG)) (@ k_a1yI) (@ (a_a1yJ :: C k_a1yI)) -> C:X @ a_a1yJ end Rec } *** End of Offense *** <no location info>: error: Compilation had errors *** Exception: ExitFailure 1
}}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15825 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15825: Core Lint error from Explicit Foralls Proposal -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Note that nothing in this program is making use of functionality that was added in the Explicit Foralls proposal. In fact, this program exhibits a Core Lint error all the way back to GHC 8.2.2 (you'll have to enable `TypeInType` and import `Data.Kind` to make it compile on older GHCs, though). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15825#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15825: Core Lint error from Explicit Foralls Proposal -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): This is fixed on GHC HEAD as of commit 5e45ad10ffca1ad175b10f6ef3327e1ed8ba25f3 (Finish fix for #14880.). It now gives a proper error message: {{{ $ ghc2/inplace/bin/ghc-stage2 --interactive Bug.hs -fprint-explicit-kinds GHCi, version 8.7.20181029: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Main ( Bug.hs, interpreted ) Bug.hs:12:29: error: • Illegal type synonym family application ‘GHC.Types.Any k’ in instance: X (a (GHC.Types.Any k)) • In the instance declaration for ‘X (a :: *)’ | 12 | instance forall (a :: C k). X (a :: *) | ^^^^^^^^^^ }}} TODO: Check this program in as a test case. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15825#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15825: Core Lint error from Explicit Foralls Proposal -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): Is that error message "proper"? I'm not sure. But at least it's technically correct, and I'd be hard-pressed to do better. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15825#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15825: Core Lint error from Explicit Foralls Proposal
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.6.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Richard Eisenberg

#15825: Core Lint error from Explicit Foralls Proposal -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | dependent/should_fail/T15825 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => closed * testcase: => dependent/should_fail/T15825 * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15825#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC