[project @ 2005-10-14 11:22:41 by simonpj]
[ghc-hetmet.git] / ghc / compiler / iface / TcIface.lhs
index 5062fd9..9feeda6 100644 (file)
@@ -46,7 +46,7 @@ import IdInfo         ( IdInfo, CafInfo(..), WorkerInfo(..),
                          vanillaIdInfo, newStrictnessInfo )
 import Class           ( Class )
 import TyCon           ( tyConDataCons, isTupleTyCon, mkForeignTyCon )
-import DataCon         ( DataCon, dataConWorkId, dataConTyVars, dataConArgTys, isVanillaDataCon )
+import DataCon         ( DataCon, dataConWorkId, dataConTyVars, dataConInstArgTys, isVanillaDataCon )
 import TysWiredIn      ( tupleCon, tupleTyCon, listTyCon, intTyCon, boolTyCon, charTyCon, parrTyCon )
 import Var             ( TyVar, mkTyVar, tyVarKind )
 import Name            ( Name, nameModule, nameIsLocalOrFrom, isWiredInName,
@@ -237,10 +237,19 @@ tcHiBootIface mod
        ; if not (isOneShot mode)
                -- In --make and interactive mode, if this module has an hs-boot file
                -- we'll have compiled it already, and it'll be in the HPT
+               -- 
+               -- We check wheher the interface is a *boot* interface.
+               -- It can happen (when using GHC from Visual Studio) that we
+               -- compile a module in TypecheckOnly mode, with a stable, 
+               -- fully-populated HPT.  In that case the boot interface isn't there
+               -- (it's been replaced by the mother module) so we can't check it.
+               -- And that's fine, because if M's ModInfo is in the HPT, then 
+               -- it's been compiled once, and we don't need to check the boot iface
          then do { hpt <- getHpt
                  ; case lookupModuleEnv hpt mod of
-                     Just info -> return (hm_details info)
-                     Nothing   -> return emptyModDetails }
+                     Just info | mi_boot (hm_iface info) 
+                               -> return (hm_details info)
+                     other -> return emptyModDetails }
          else do
 
        -- OK, so we're in one-shot mode.  
@@ -673,7 +682,7 @@ tcIfaceAlt (tycon, inst_tys) (IfaceDataAlt data_occ, arg_occs, rhs)
          arg_names <- newIfaceNames arg_occs
        ; let   tyvars   = [ mkTyVar name (tyVarKind tv) 
                           | (name,tv) <- arg_names `zip` dataConTyVars con] 
-               arg_tys  = dataConArgTys con (mkTyVarTys tyvars)
+               arg_tys  = dataConInstArgTys con (mkTyVarTys tyvars)
                id_names = dropList tyvars arg_names
                arg_ids  = ASSERT2( equalLength id_names arg_tys,
                                    ppr (con, arg_names, rhs) $$ ppr tyvars $$ ppr arg_tys )
@@ -691,7 +700,7 @@ tcIfaceAlt (tycon, inst_tys) (IfaceTupleAlt boxity, arg_occs, rhs)
 
 tcVanillaAlt data_con inst_tys arg_occs rhs
   = do { arg_names <- newIfaceNames arg_occs
-       ; let arg_tys = dataConArgTys data_con inst_tys
+       ; let arg_tys = dataConInstArgTys data_con inst_tys
        ; let arg_ids = ASSERT2( equalLength arg_names arg_tys,
                                 ppr data_con <+> ppr inst_tys <+> ppr arg_occs $$ ppr rhs )
                        zipWith mkLocalId arg_names arg_tys