[project @ 1999-05-10 17:53:59 by sof]
authorsof <unknown>
Mon, 10 May 1999 17:54:00 +0000 (17:54 +0000)
committersof <unknown>
Mon, 10 May 1999 17:54:00 +0000 (17:54 +0000)
Assuming that the TC sometime in the future will want to start looking
at infix decls (right, Simon?), the renamer currently passes them on
rather than filter.

Couple of TC tweaks to have it non-burpingly handle such FixSigs
inside class decls.

ghc/compiler/typecheck/TcClassDcl.lhs
ghc/compiler/typecheck/TcTyClsDecls.lhs

index 9943242..e3289b3 100644 (file)
@@ -12,7 +12,7 @@ import HsSyn          ( HsDecl(..), TyClDecl(..), Sig(..), MonoBinds(..),
                          InPat(..), HsBinds(..), GRHSs(..),
                          HsExpr(..), HsLit(..), HsType(..), pprClassAssertion,
                          unguardedRHS, andMonoBinds, andMonoBindList, getTyVarName,
-                         isClassDecl
+                         isClassDecl, isClassOpSig
                        )
 import HsPragmas       ( ClassPragmas(..) )
 import BasicTypes      ( NewOrData(..), TopLevelFlag(..), RecFlag(..), StrictnessMark(..) )
@@ -125,10 +125,12 @@ kcClassDecl (ClassDecl    context class_name
        -- The net effect is to mutate the class kind
     tcExtendTopTyVarScope kind tyvar_names     $ \ _ _ ->
     tcContext context                          `thenTc_`
-    mapTc kc_sig class_sigs                    `thenTc_`
+    mapTc kc_sig the_class_sigs                        `thenTc_`
 
     returnTc ()
   where
+    the_class_sigs = filter isClassOpSig class_sigs
+  
     kc_sig (ClassOpSig _ _ op_ty loc) = tcAddSrcLoc loc (tcHsType op_ty)
 \end{code}
 
@@ -156,7 +158,8 @@ tcClassDecl1 rec_env rec_inst_mapper
 --  traceTc (text "tcClassCtxt done" <+> ppr class_name)       `thenTc_`
 
        -- CHECK THE CLASS SIGNATURES,
-    mapTc (tcClassSig rec_env rec_class tyvars) class_sigs
+    mapTc (tcClassSig rec_env rec_class tyvars) 
+         (filter isClassOpSig class_sigs)
                                                `thenTc` \ sig_stuff ->
 
        -- MAKE THE CLASS OBJECT ITSELF
index 995d0a1..e4ad273 100644 (file)
@@ -325,10 +325,11 @@ get_tys tys
 
 ----------------------------------------------------
 get_sigs sigs
-  = unionManyUniqSets (map get_sig sigs)
+  = unionManyUniqSets (mapMaybe get_sig sigs)
   where 
-    get_sig (ClassOpSig _ _ ty _) = get_ty ty
-    get_sig other = panic "TcTyClsDecls:get_sig"
+    get_sig (ClassOpSig _ _ ty _) = Just (get_ty ty)
+    get_sig (FixSig _)           = Nothing
+    get_sig other                = panic "TcTyClsDecls:get_sig"
 
 ----------------------------------------------------
 set_name name = unitUniqSet (getUnique name)