Store a SrcSpan instead of a SrcLoc inside a Name
[ghc-hetmet.git] / compiler / deSugar / Check.lhs
index 359035f..9f3bad0 100644 (file)
@@ -11,7 +11,6 @@ module Check ( check , ExhaustivePat ) where
 
 import HsSyn           
 import TcHsSyn
-import TcType
 import DsUtils
 import MatchLit
 import Id
@@ -249,7 +248,7 @@ must be one Variable to be complete.
 
 process_literals :: [HsLit] -> [(EqnNo, EquationInfo)] -> ([ExhaustivePat],EqnSet)
 process_literals used_lits qs 
-  | null default_eqns  = ([make_row_vars used_lits (head qs)] ++ pats,indexs)
+  | null default_eqns  = ASSERT( not (null qs) ) ([make_row_vars used_lits (head qs)] ++ pats,indexs)
   | otherwise          = (pats_default,indexs_default)
      where
        (pats,indexs)   = process_explicit_literals used_lits qs
@@ -331,7 +330,7 @@ need_default_case used_cons unused_cons qs
        (pats',indexs') = check' default_eqns 
        pats_default    = [(make_whole_con c:ps,constraints) | 
                           c <- unused_cons, (ps,constraints) <- pats'] ++ pats
-       new_wilds       = make_row_vars_for_constructor (head qs)
+       new_wilds       = ASSERT( not (null qs) ) make_row_vars_for_constructor (head qs)
        pats_default_no_eqns =  [(make_whole_con c:new_wilds,[]) | c <- unused_cons] ++ pats
        indexs_default  = unionUniqSets indexs' indexs
 
@@ -379,7 +378,7 @@ make_row_vars used_lits (_, EqnInfo { eqn_pats = pats})
 
 hash_x = mkInternalName unboundKey {- doesn't matter much -}
                     (mkVarOccFS FSLIT("#x"))
-                    noSrcLoc
+                    noSrcSpan
 
 make_row_vars_for_constructor :: (EqnNo, EquationInfo) -> [WarningPat]
 make_row_vars_for_constructor (_, EqnInfo { eqn_pats = pats}) 
@@ -432,7 +431,7 @@ mb_neg Nothing  v = v
 mb_neg (Just _) v = -v
 
 get_unused_cons :: [Pat Id] -> [DataCon]
-get_unused_cons used_cons = unused_cons
+get_unused_cons used_cons = ASSERT( not (null used_cons) ) unused_cons
      where
        (ConPatOut { pat_con = l_con, pat_ty = ty }) = head used_cons
        ty_con         = dataConTyCon (unLoc l_con)     -- Newtype observable