[GHC] #15795: Core lint error with unused kind variable in data type return kind

GHC ghc-devs at haskell.org
Thu Dec 13 14:21:20 UTC 2018


#15795: Core lint error with unused kind variable in data type return kind
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.6.1
      Resolution:                    |             Keywords:  TypeInType
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):

 Here's another way to trigger (what I believe to be) the same issue:

 {{{#!hs
 {-# LANGUAGE DataKinds #-}
 {-# LANGUAGE GADTs #-}
 {-# LANGUAGE PolyKinds #-}
 {-# LANGUAGE ScopedTypeVariables #-}
 module Bug where

 import Data.Kind

 type KindOf (a :: k) = k

 data T :: forall j (a :: j). KindOf a -> Type where
   MkT :: forall k (b :: k). T b
 }}}
 {{{
 $ /opt/ghc/8.6.3/bin/ghc Bug.hs -dcore-lint
 [1 of 1] Compiling Bug              ( Bug.hs, Bug.o )
 *** Core Lint errors : in result of Tidy Core ***
 <no location info>: warning:
     In the type ‘forall (a :: k_aVT[sk:1]) k (b :: k). T b’
     @ k_aVT[sk:1] is out of scope
 *** Offending Program ***
 $WMkT [InlPrag=INLINE[2]]
   :: forall (a :: k_aVT[sk:1]) k (b :: k). T b
 [GblId[DataConWrapper],
  Caf=NoCafRefs,
  Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
          WorkFree=True, Expandable=True,
          Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=True)
          Tmpl= \ (@ (a_aWw :: k_aVT[sk:1]))
                  (@ k_XVV)
                  (@ (b_aVU :: k_XVV)) ->
                  MkT @ k_XVV @ a_aWw @ b_aVU}]
 $WMkT
   = \ (@ (a_aWw :: k_aVT[sk:1])) (@ k_XVV) (@ (b_aVU :: k_XVV)) ->
       MkT @ k_XVV @ a_aWw @ b_aVU

 <elided>

 *** End of Offense ***


 <no location info>: error:
 Compilation had errors
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15795#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list