diff options
Diffstat (limited to 'compiler/iface/TcIface.hs')
-rw-r--r-- | compiler/iface/TcIface.hs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/compiler/iface/TcIface.hs b/compiler/iface/TcIface.hs index 45b583cd91..da94136218 100644 --- a/compiler/iface/TcIface.hs +++ b/compiler/iface/TcIface.hs @@ -50,7 +50,7 @@ import PrelNames import TysWiredIn import TysPrim ( superKindTyConName ) import BasicTypes ( strongLoopBreaker, Arity, TupleSort(..) - , Boxity(..), pprRuleName ) + , Boxity(..), DefMethSpec(..), pprRuleName ) import Literal import qualified Var import VarEnv @@ -419,13 +419,23 @@ tc_iface_decl _parent ignore_prags -- Here the associated type T is knot-tied with the class, and -- so we must not pull on T too eagerly. See Trac #5970 - tc_sig (IfaceClassOp occ dm rdr_ty) + tc_sig :: IfaceClassOp -> IfL TcMethInfo + tc_sig (IfaceClassOp occ rdr_ty dm) = do { op_name <- lookupIfaceTop occ - ; op_ty <- forkM (mk_op_doc op_name rdr_ty) (tcIfaceType rdr_ty) + ; ~(op_ty, dm') <- forkM (mk_op_doc op_name rdr_ty) $ + do { ty <- tcIfaceType rdr_ty + ; dm' <- tc_dm dm + ; return (ty, dm') } -- Must be done lazily for just the same reason as the -- type of a data con; to avoid sucking in types that -- it mentions unless it's necessary to do so - ; return (op_name, dm, op_ty) } + ; return (op_name, op_ty, dm') } + + tc_dm :: Maybe (DefMethSpec IfaceType) -> IfL (Maybe (DefMethSpec Type)) + tc_dm Nothing = return Nothing + tc_dm (Just VanillaDM) = return (Just VanillaDM) + tc_dm (Just (GenericDM ty)) = do { ty' <- tcIfaceType ty + ; return (Just (GenericDM ty')) } tc_at cls (IfaceAT tc_decl if_def) = do ATyCon tc <- tc_iface_decl (Just cls) ignore_prags tc_decl |