GHC HEAD-only Core Lint error with unboxed equality (Non-CoVar has coercion type)
module Foo where
import Language.Haskell.TH.Lib
import Language.Haskell.TH.Syntax
ueqT :: Q Type
ueqT = conT $ mkNameG_tc "ghc-prim" "GHC.Prim" "~#"
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TemplateHaskell #-}
module Bug where
import Data.Kind
import Foo (ueqT)
data JankyEquality :: Type -> Type -> Type where
Jank :: $ueqT a b -> JankyEquality a b
unJank :: JankyEquality a b -> $ueqT a b
unJank (Jank x) = x
$ ~/Software/ghc5/inplace/bin/ghc-stage2 --interactive Bug.hs -dcore-lint
GHCi, version 8.7.20190115: https://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 2] Compiling Foo ( Foo.hs, interpreted )
[2 of 2] Compiling Bug ( Bug.hs, interpreted )
*** Core Lint errors : in result of Desugar (before optimization) ***
<no location info>: warning:
In a case alternative: (Jank x_a4vR :: a_a4wC ~# b_a4wD)
Non-CoVar has coercion type x_a4vR :: a_a4wC ~# b_a4wD
*** Offending Program ***
<elided>
unJank :: forall a b. JankyEquality a b -> a ~# b
[LclIdX]
unJank
= \ (@ a_a4wC)
(@ b_a4wD)
(ds_d4wN :: JankyEquality a_a4wC b_a4wD) ->
case ds_d4wN of wild_00 { Jank x_a4vR -> break<0>() x_a4vR }
Note that this passes -dcore-lint
on GHC 8.0.2 through 8.6.3.
Trac metadata
Trac field | Value |
---|---|
Version | 8.6.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |