Some more ASSERTs
authorManuel M T Chakravarty <chak@cse.unsw.edu.au>
Wed, 20 Sep 2006 18:54:32 +0000 (18:54 +0000)
committerManuel M T Chakravarty <chak@cse.unsw.edu.au>
Wed, 20 Sep 2006 18:54:32 +0000 (18:54 +0000)
Wed Sep 20 02:52:00 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
  * Some more ASSERTs

compiler/typecheck/TcMType.lhs
compiler/typecheck/TcType.lhs

index 23c3381..f01d69d 100644 (file)
@@ -368,7 +368,8 @@ data LookupTyVarResult      -- The result of a lookupTcTyVar call
 
 lookupTcTyVar :: TcTyVar -> TcM LookupTyVarResult
 lookupTcTyVar tyvar 
-  = case details of
+  = ASSERT( isTcTyVar tyvar )
+    case details of
       SkolemTv _   -> return (DoneTv details)
       MetaTv _ ref -> do { meta_details <- readMutVar ref
                         ; case meta_details of
index 94ea3f9..f266f4b 100644 (file)
@@ -399,6 +399,7 @@ mkKindName unique = mkSystemName unique kind_var_occ
 
 kindVarRef :: KindVar -> IORef MetaDetails
 kindVarRef tc = 
+  ASSERT ( isTcTyVar tc )
   case tcTyVarDetails tc of
     MetaTv TauTv ref -> ref
     other            -> pprPanic "kindVarRef" (ppr tc)
@@ -472,7 +473,8 @@ pprSkolTvBinding :: TcTyVar -> SDoc
 -- Print info about the binding of a skolem tyvar, 
 -- or nothing if we don't have anything useful to say
 pprSkolTvBinding tv
-  = ppr_details (tcTyVarDetails tv)
+  = ASSERT ( isTcTyVar tv )
+    ppr_details (tcTyVarDetails tv)
   where
     ppr_details (MetaTv TauTv _)   = quotes (ppr tv) <+> ptext SLIT("is a meta type variable")
     ppr_details (MetaTv BoxTv _)   = quotes (ppr tv) <+> ptext SLIT("is a boxy type variable")