Commit d8d4266b authored by Richard Eisenberg's avatar Richard Eisenberg

Fix #14991.

It turns out that solveEqualities really does need to use simpl_top.
I thought that solveWanteds would be enough, and no existing test
case showed up the different. #14991 shows that we need simpl_top.
Easy enough to fix.

test case: dependent/should_compile/T14991
parent ddf89557
......@@ -165,7 +165,9 @@ solveEqualities thing_inside
= checkNoErrs $ -- See Note [Fail fast on kind errors]
do { (result, wanted) <- captureConstraints thing_inside
; traceTc "solveEqualities {" $ text "wanted = " <+> ppr wanted
; final_wc <- runTcSEqualities $ solveWanteds wanted
; final_wc <- runTcSEqualities $ simpl_top wanted
-- NB: Use simpl_top here so that we potentially default RuntimeRep
-- vars to LiftedRep. This is needed to avoid #14991.
; traceTc "End solveEqualities }" empty
; traceTc "reportAllUnsolved {" empty
......
......@@ -1485,7 +1485,7 @@ So, the kind-checker must return both the new args (that is, Type
Because we don't need this information in the kind-checking phase of
checking closed type families, we don't require these extra pieces of
information in tc_fam_ty_pats. See also Note [tc_fam_ty_pats vs tcFamTyPats].
information in tc_fam_ty_pats.
Note [Failing early in kcDataDefn]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module T14991 where
import Data.Kind
type family Promote (k :: Type) :: Type
type family PromoteX (a :: k) :: Promote k
type family Demote (k :: Type) :: Type
type family DemoteX (a :: k) :: Demote k
-----
-- Type
-----
type instance Demote Type = Type
type instance Promote Type = Type
type instance DemoteX (a :: Type) = Demote a
type instance PromoteX (a :: Type) = Promote a
-----
-- Arrows
-----
data TyFun :: Type -> Type -> Type
type a ~> b = TyFun a b -> Type
infixr 0 ~>
type instance Demote (a ~> b) = DemoteX a -> DemoteX b
type instance Promote (a -> b) = PromoteX a ~> PromoteX b
......@@ -34,3 +34,4 @@ test('T14556', normal, compile, [''])
test('T14720', normal, compile, [''])
test('T14066a', normal, compile, [''])
test('T14749', normal, compile, [''])
test('T14991', normal, compile, [''])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment