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

Fix #11255.

We need to instantiate types in tuples. Quite straightforward.
parent bc8cac12
......@@ -600,13 +600,16 @@ tc_hs_type mode (HsExplicitListTy _k tys) exp_kind
mk_nil k = mkTyConApp (promoteDataCon nilDataCon) [k]
tc_hs_type mode (HsExplicitTupleTy _ tys) exp_kind
= do { tks <- mapM (tc_infer_lhs_type mode) tys
; let n = length tys
kind_con = tupleTyCon Boxed n
ty_con = promotedTupleDataCon Boxed n
(taus, ks) = unzip tks
-- using newMetaKindVar means that we force instantiations of any polykinded
-- types. At first, I just used tc_infer_lhs_type, but that led to #11255.
= do { ks <- replicateM arity newMetaKindVar
; taus <- zipWithM (tc_lhs_type mode) tys ks
; let kind_con = tupleTyCon Boxed arity
ty_con = promotedTupleDataCon Boxed arity
tup_k = mkTyConApp kind_con ks
; checkExpectedKind (mkTyConApp ty_con (ks ++ taus)) tup_k exp_kind }
where
arity = length tys
--------- Constraint types
tc_hs_type mode (HsIParamTy n ty) exp_kind
......
{-# LANGUAGE TypeFamilies, PolyKinds, DataKinds, UndecidableInstances #-}
module T11255 where
type family Default :: k
type instance Default = '(Default, Default)
......@@ -131,3 +131,4 @@ test('TidyClassKinds', normal, compile_fail, ['-fprint-explicit-kinds'])
test('T11249', normal, compile, [''])
test('T11248', normal, compile, [''])
test('T11278', normal, compile, [''])
test('T11255', 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