Commit bafbde7e authored by eir@cis.upenn.edu's avatar eir@cis.upenn.edu
Browse files

Constrained types have kind * in validity check.

This addresses #11405, but a deeper problem lurks.
Try test dependent/should_compile/T11405 and see comment:3
on the ticket.
parent 39ea4b4b
......@@ -452,12 +452,17 @@ check_type env ctxt rank ty
-- but not type T = ?x::Int
; check_type env' ctxt rank tau -- Allow foralls to right of arrow
; checkTcM (not (any (`elemVarSet` tyCoVarsOfType tau_kind) tvs))
; checkTcM (not (any (`elemVarSet` tyCoVarsOfType phi_kind) tvs))
(forAllEscapeErr env' ty tau_kind)
}
where
(tvs, theta, tau) = tcSplitSigmaTy ty
tau_kind = typeKind tau
phi_kind | null theta = tau_kind
| otherwise = liftedTypeKind
-- If there are any constraints, the kind is *. (#11405)
(env', _) = tidyTyCoVarBndrs env tvs
check_type _ _ _ (TyVarTy _) = return ()
......
{-# LANGUAGE ImplicitParams, TypeInType, ExplicitForAll #-}
module T11405 where
import GHC.Exts
import GHC.Stack
x :: forall (v :: Levity) (a :: TYPE v). (?callStack :: CallStack) => a
x = undefined
......@@ -12,3 +12,5 @@ test('TypeLevelVec',normal,compile, [''])
test('T9632', normal, compile, [''])
test('dynamic-paper', normal, compile, [''])
test('T11311', normal, compile, [''])
test('T11405', expect_broken(11405), 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