From: simonpj Date: Wed, 22 Oct 2003 16:25:43 +0000 (+0000) Subject: [project @ 2003-10-22 16:25:42 by simonpj] X-Git-Tag: Approx_11550_changesets_converted~337 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=4fef5c33a7820baed722052589a21dc3037d3c2e;p=ghc-hetmet.git [project @ 2003-10-22 16:25:42 by simonpj] Do foralls right in the renamer --- diff --git a/ghc/compiler/hsSyn/HsTypes.lhs b/ghc/compiler/hsSyn/HsTypes.lhs index e3e2262..d3661cb 100644 --- a/ghc/compiler/hsSyn/HsTypes.lhs +++ b/ghc/compiler/hsSyn/HsTypes.lhs @@ -8,7 +8,8 @@ module HsTypes ( HsType(..), HsTyVarBndr(..), HsExplicitForAll(..), , HsContext, HsPred(..) - , mkExplicitHsForAllTy, mkImplicitHsForAllTy, mkHsDictTy, mkHsIParamTy + , mkExplicitHsForAllTy, mkImplicitHsForAllTy, + , mkHsDictTy, mkHsIParamTy , hsTyVarName, hsTyVarNames, replaceTyVarName , splitHsInstDeclTy diff --git a/ghc/compiler/rename/RnTypes.lhs b/ghc/compiler/rename/RnTypes.lhs index cf998b6..227cce5 100644 --- a/ghc/compiler/rename/RnTypes.lhs +++ b/ghc/compiler/rename/RnTypes.lhs @@ -167,11 +167,22 @@ rnHsTypes doc tys = mappM (rnHsType doc) tys \begin{code} +rnForAll doc exp [] [] ty = rnHsType doc ty + -- One reason for this case is that a type like Int# + -- starts of as (HsForAllTy Nothing [] Int), in case + -- there is some quantification. Now that we have quantified + -- and discovered there are no type variables, it's nicer to turn + -- it into plain Int. If it were Int# instead of Int, we'd actually + -- get an error, because the body of a genuine for-all is + -- of kind *. + rnForAll doc exp forall_tyvars ctxt ty = bindTyVarsRn doc forall_tyvars $ \ new_tyvars -> rnContext doc ctxt `thenM` \ new_ctxt -> rnHsType doc ty `thenM` \ new_ty -> returnM (HsForAllTy exp new_tyvars new_ctxt new_ty) + -- Retain the same implicit/explicit flag as before + -- so that we can later print it correctly \end{code} diff --git a/ghc/compiler/typecheck/TcHsType.lhs b/ghc/compiler/typecheck/TcHsType.lhs index d85c492..7e9338f 100644 --- a/ghc/compiler/typecheck/TcHsType.lhs +++ b/ghc/compiler/typecheck/TcHsType.lhs @@ -218,6 +218,7 @@ kcTypeType ty return ty' else newOpenTypeKind `thenM` \ type_kind -> + traceTc (text "kcTypeType" $$ nest 2 (ppr ty $$ ppr ty' $$ ppr kind $$ ppr type_kind)) `thenM_` checkExpectedKind (ppr ty) kind type_kind `thenM_` returnM ty'