X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcRnDriver.lhs;h=8638d9f5ec2bd5db3c36458a313d00e147eb7ca0;hb=1f4bc1f36380776c68431dbc3b5fa41dd6d2182e;hp=069446fb43504d6abbef56ae027840e745d729bb;hpb=de1a1f9f882cf1a5c81c4a152edc001aafd3f8a3;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcRnDriver.lhs b/compiler/typecheck/TcRnDriver.lhs index 069446f..8638d9f 100644 --- a/compiler/typecheck/TcRnDriver.lhs +++ b/compiler/typecheck/TcRnDriver.lhs @@ -297,7 +297,7 @@ tcRnExtCore hsc_env (HsExtCore this_mod decls src_binds) -- any mutually recursive types are done right -- Just discard the auxiliary bindings; they are generated -- only for Haskell source code, and should already be in Core - (tcg_env, _aux_binds) <- tcTyAndClassDecls emptyModDetails rn_decls ; + (tcg_env, _aux_binds, _dm_ids) <- tcTyAndClassDecls emptyModDetails rn_decls ; setGblEnv tcg_env $ do { -- Make the new type env available to stuff slurped from interface files @@ -485,8 +485,10 @@ tcRnHsBootDecls decls -- Typecheck type/class decls ; traceTc (text "Tc2") - ; (tcg_env, aux_binds) <- tcTyAndClassDecls emptyModDetails tycl_decls - ; setGblEnv tcg_env $ do { + ; (tcg_env, aux_binds, dm_ids) + <- tcTyAndClassDecls emptyModDetails tycl_decls + ; setGblEnv tcg_env $ + tcExtendIdEnv dm_ids $ do { -- Typecheck instance decls -- Family instance declarations are rejected here @@ -821,10 +823,12 @@ tcTopSrcDecls boot_details -- The latter come in via tycl_decls traceTc (text "Tc2") ; - (tcg_env, aux_binds) <- tcTyAndClassDecls boot_details tycl_decls ; + (tcg_env, aux_binds, dm_ids) <- tcTyAndClassDecls boot_details tycl_decls ; -- If there are any errors, tcTyAndClassDecls fails here - setGblEnv tcg_env $ do { + setGblEnv tcg_env $ + tcExtendIdEnv dm_ids $ do { + -- Source-language instances, including derivings, -- and import the supporting declarations traceTc (text "Tc3") ; @@ -854,13 +858,12 @@ tcTopSrcDecls boot_details (tc_val_binds, tcl_env) <- setLclTypeEnv tcl_env $ tcTopBinds val_binds; + setLclTypeEnv tcl_env $ do { -- Environment doesn't change now + -- Second pass over class and instance declarations, traceTc (text "Tc6") ; - (inst_binds, tcl_env) <- setLclTypeEnv tcl_env $ - tcInstDecls2 tycl_decls inst_infos ; - showLIE (text "after instDecls2") ; - - setLclTypeEnv tcl_env $ do { -- Environment doesn't change now + inst_binds <- tcInstDecls2 tycl_decls inst_infos ; + showLIE (text "after instDecls2") ; -- Foreign exports traceTc (text "Tc7") ;