TcHsType: set the kind for tyvars that occur in explicit code types
[ghc-hetmet.git] / compiler / typecheck / TcHsType.lhs
index f7f3da6..669c61c 100644 (file)
@@ -37,6 +37,7 @@ import TcMType
 import TcUnify
 import TcIface
 import TcType
+import TypeRep ( ecKind )
 import {- Kind parts of -} Type
 import Var
 import VarSet
@@ -366,6 +367,7 @@ kc_hs_type (HsPArrTy ty) = do
     return (HsPArrTy ty', liftedTypeKind)
 
 kc_hs_type (HsModalBoxType ecn ty) = do
+    kc_check_hs_type (HsTyVar ecn) (EK ecKind EkUnk)
     ty' <- kcLiftedType ty
     return (HsModalBoxType ecn ty', liftedTypeKind)
 
@@ -594,11 +596,9 @@ ds_type (HsPArrTy ty) = do
     return (mkPArrTy tau_ty)
 
 ds_type (HsModalBoxType ecn ty) = do
-    ecn' <- ds_app (HsTyVar ecn) []
     tau_ty <- dsHsType ty
     checkWiredInTyCon hetMetCodeTypeTyCon
-    return (mkHetMetCodeTypeTy (tcGetTyVar "totally bogus, dude" ecn') tau_ty)
-
+    return (mkHetMetCodeTypeTy (mkTyVar ecn ecKind) tau_ty)
 
 ds_type (HsTupleTy boxity tys) = do
     tau_tys <- dsHsTypes tys