[GHC] #7973: Simplifier introduces unbound kind variables (caught by -dcore-lint)
#7973: Simplifier introduces unbound kind variables (caught by -dcore-lint) -----------------------------+---------------------------------------------- Reporter: diatchki | Owner: Type: bug | Status: new Priority: normal | Component: Compiler (Type checker) Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- I encountered a problem in GHC (happens with 7.6.3 and HEAD), where compiling with optimizations (-O2) results in invalid core (unbound kind variable). I managed to reduce my example to the following: {{{ {-# LANGUAGE DataKinds, PolyKinds, KindSignatures #-} {-# LANGUAGE ExistentialQuantification, UndecidableInstances, TypeFamilies #-} module Test where -- Kind-level proxies. data {-kind-} K (a :: *) = KP -- A type with 1 kind-polymorphic type argument. data T (n :: k) -- A type with 1 kind argument. data F (kp :: K k) -- A class with 1 kind argument. class (kp ~ KP) => C (kp :: K k) where f :: T (a :: k) -> F kp -- A type with 1 kind argument. -- Contains an existentially quantified type-variable of this kind. data SomeT (kp :: K k) = forall (n :: k). Mk (T n) -- Show `SomeT` by converting it to `F`, using `C`. instance (C kp, Show (F kp)) => Show (SomeT kp) where show (Mk x) = show (f x) }}} I compiled it with these flags: {{{ ghc-stage2 -c -O2 -dcore-lint test.hs }}} Part of the core-lint complaint is: {{{ *** Core Lint errors : in result of Simplifier *** <no location info>: Warning: In the expression: ww_snF @ n_akd (x_aie `cast` (Sym (Nth:0 ((forall (a_ai7 :: k_aj7). <Test.T k_ajF a_ai7> -> Test.F <k_ajF> cobox_dkK)@n_akd)) :: Test.T k_ajF n_akd ~# Test.T k_ajF n_akd)) @ (k_aj7 :: BOX) is out of scope }}} -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7973> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#7973: Simplifier introduces unbound kind variables (caught by -dcore-lint) -----------------------------+---------------------------------------------- Reporter: diatchki | Owner: Type: bug | Status: new Priority: normal | Component: Compiler (Type checker) Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Comment(by simonpj@…): commit 8c846f714223c33adef76e6072ba94d3e33b7e97 {{{ Author: Simon Peyton Jones <simonpj@microsoft.com> Date: Mon Jun 10 11:04:09 2013 +0100 Fix substitution but in liftCoSubst (Trac #7973) Iavor uncovered this subtle omission in liftCoSubst. The problem and its solution are desribed in Note [Substituting kinds in liftCoSubst] compiler/types/Coercion.lhs | 82 +++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 79 insertions(+), 3 deletions(-) }}} -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7973#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#7973: Simplifier introduces unbound kind variables (caught by -dcore-lint) --------------------------------------+------------------------------------- Reporter: diatchki | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.7 Resolution: fixed | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: polykinds/T7973 | Blockedby: Blocking: | Related: --------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * difficulty: => Unknown * resolution: => fixed * testcase: => polykinds/T7973 Comment: Great point. Exposed a subtle bug, which I have now fixed. Thank you! Simon -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7973#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC