-rnIdInfo (HsStrictness str) = returnRn (HsStrictness str, emptyFVs)
-
-rnIdInfo (HsWorker worker)
- = lookupOccRn worker `thenRn` \ worker' ->
- returnRn (HsWorker worker', unitFV worker')
-
-rnIdInfo (HsUnfold inline (Just expr)) = rnCoreExpr expr `thenRn` \ (expr', fvs) ->
- returnRn (HsUnfold inline (Just expr'), fvs)
-rnIdInfo (HsUnfold inline Nothing) = returnRn (HsUnfold inline Nothing, emptyFVs)
-rnIdInfo (HsArity arity) = returnRn (HsArity arity, emptyFVs)
-rnIdInfo (HsUpdate update) = returnRn (HsUpdate update, emptyFVs)
-rnIdInfo (HsNoCafRefs) = returnRn (HsNoCafRefs, emptyFVs)
-rnIdInfo (HsCprInfo cpr_info) = returnRn (HsCprInfo cpr_info, emptyFVs)
-rnIdInfo (HsSpecialise rule_body) = rnRuleBody rule_body `thenRn` \ (rule_body', fvs) ->
- returnRn (HsSpecialise rule_body', fvs)
-
-rnRuleBody (UfRuleBody str vars args rhs)
- = rnCoreBndrs vars $ \ vars' ->
- mapFvRn rnCoreExpr args `thenRn` \ (args', fvs1) ->
- rnCoreExpr rhs `thenRn` \ (rhs', fvs2) ->
- returnRn (UfRuleBody str vars' args' rhs', fvs1 `plusFV` fvs2)
-\end{code}
-
-UfCore expressions.
-
-\begin{code}
-rnCoreExpr (UfType ty)
- = rnHsType (text "unfolding type") ty `thenRn` \ (ty', fvs) ->
- returnRn (UfType ty', fvs)
-
-rnCoreExpr (UfVar v)
- = lookupOccRn v `thenRn` \ v' ->
- returnRn (UfVar v', unitFV v')
-
-rnCoreExpr (UfCon con args)
- = rnUfCon con `thenRn` \ (con', fvs1) ->
- mapFvRn rnCoreExpr args `thenRn` \ (args', fvs2) ->
- returnRn (UfCon con' args', fvs1 `plusFV` fvs2)
-
-rnCoreExpr (UfTuple con args)
- = lookupOccRn con `thenRn` \ con' ->
- mapFvRn rnCoreExpr args `thenRn` \ (args', fvs) ->
- returnRn (UfTuple con' args', fvs `addOneFV` con')
-
-rnCoreExpr (UfApp fun arg)
- = rnCoreExpr fun `thenRn` \ (fun', fv1) ->
- rnCoreExpr arg `thenRn` \ (arg', fv2) ->
- returnRn (UfApp fun' arg', fv1 `plusFV` fv2)
-
-rnCoreExpr (UfCase scrut bndr alts)
- = rnCoreExpr scrut `thenRn` \ (scrut', fvs1) ->
- bindCoreLocalFVRn bndr ( \ bndr' ->
- mapFvRn rnCoreAlt alts `thenRn` \ (alts', fvs2) ->
- returnRn (UfCase scrut' bndr' alts', fvs2)
- ) `thenRn` \ (case', fvs3) ->
- returnRn (case', fvs1 `plusFV` fvs3)
-
-rnCoreExpr (UfNote note expr)
- = rnNote note `thenRn` \ (note', fvs1) ->
- rnCoreExpr expr `thenRn` \ (expr', fvs2) ->
- returnRn (UfNote note' expr', fvs1 `plusFV` fvs2)
-
-rnCoreExpr (UfLam bndr body)
- = rnCoreBndr bndr $ \ bndr' ->
- rnCoreExpr body `thenRn` \ (body', fvs) ->
- returnRn (UfLam bndr' body', fvs)
-
-rnCoreExpr (UfLet (UfNonRec bndr rhs) body)
- = rnCoreExpr rhs `thenRn` \ (rhs', fvs1) ->
- rnCoreBndr bndr ( \ bndr' ->
- rnCoreExpr body `thenRn` \ (body', fvs2) ->
- returnRn (UfLet (UfNonRec bndr' rhs') body', fvs2)
- ) `thenRn` \ (result, fvs3) ->
- returnRn (result, fvs1 `plusFV` fvs3)
-
-rnCoreExpr (UfLet (UfRec pairs) body)
- = rnCoreBndrs bndrs $ \ bndrs' ->
- mapFvRn rnCoreExpr rhss `thenRn` \ (rhss', fvs1) ->
- rnCoreExpr body `thenRn` \ (body', fvs2) ->
- returnRn (UfLet (UfRec (bndrs' `zip` rhss')) body', fvs1 `plusFV` fvs2)
+rnConDecls :: Name -> [LConDecl RdrName] -> RnM [LConDecl Name]
+rnConDecls tycon condecls
+ = -- Check that there's at least one condecl,
+ -- or else we're reading an interface file, or -fglasgow-exts
+ (if null condecls then
+ doptM Opt_GlasgowExts `thenM` \ glaExts ->
+ checkErr glaExts (emptyConDeclsErr tycon)
+ else returnM ()
+ ) `thenM_`
+ mappM (wrapLocM rnConDecl) condecls
+
+rnConDecl :: ConDecl RdrName -> RnM (ConDecl Name)
+rnConDecl (ConDecl name tvs cxt details)
+ = addLocM checkConName name `thenM_`
+ lookupLocatedTopBndrRn name `thenM` \ new_name ->
+
+ bindTyVarsRn doc tvs $ \ new_tyvars ->
+ rnContext doc cxt `thenM` \ new_context ->
+ rnConDetails doc details `thenM` \ new_details ->
+ returnM (ConDecl new_name new_tyvars new_context new_details)