X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Frename%2FRnExpr.lhs;h=6fe6904d4215a2b2a89d3f5863b5ff689ef0e0e4;hb=c1681a73fa4ca4cf8758264ae387ac09a9e900d8;hp=421a0f32d1c0a8962c6734eab1d6f9bf34589150;hpb=3c4a732b0b011cf356eed1ecd4fdc4d5f1aab193;p=ghc-hetmet.git diff --git a/compiler/rename/RnExpr.lhs b/compiler/rename/RnExpr.lhs index 421a0f3..6fe6904 100644 --- a/compiler/rename/RnExpr.lhs +++ b/compiler/rename/RnExpr.lhs @@ -20,14 +20,13 @@ import RnSource ( rnSrcDecls, rnSplice, checkTH ) import RnBinds ( rnLocalBindsAndThen, rnValBinds, rnMatchGroup, trimWith ) import HsSyn -import RnHsSyn import TcRnMonad import RnEnv import HscTypes ( availNames ) import RnNames ( getLocalDeclBinders, extendRdrEnvRn ) import RnTypes ( rnHsTypeFVs, rnLPat, rnOverLit, rnPatsAndThen, rnLit, mkOpFormRn, mkOpAppRn, mkNegAppRn, checkSectionPrec, - dupFieldErr, checkTupSize ) + rnHsRecFields, checkTupSize ) import DynFlags ( DynFlag(..) ) import BasicTypes ( FixityDirection(..) ) import SrcLoc ( SrcSpan ) @@ -220,17 +219,18 @@ rnExpr e@(ExplicitTuple exps boxity) rnExprs exps `thenM` \ (exps', fvs) -> returnM (ExplicitTuple exps' boxity, fvs) -rnExpr (RecordCon con_id _ (HsRecordBinds rbinds)) - = lookupLocatedOccRn con_id `thenM` \ conname -> - rnRbinds "construction" rbinds `thenM` \ (rbinds', fvRbinds) -> - returnM (RecordCon conname noPostTcExpr (HsRecordBinds rbinds'), - fvRbinds `addOneFV` unLoc conname) +rnExpr (RecordCon con_id _ rbinds) + = do { conname <- lookupLocatedOccRn con_id + ; (rbinds', fvRbinds) <- rnHsRecFields "construction" (Just conname) + rnLExpr HsVar rbinds + ; return (RecordCon conname noPostTcExpr rbinds', + fvRbinds `addOneFV` unLoc conname) } -rnExpr (RecordUpd expr (HsRecordBinds rbinds) _ _ _) - = rnLExpr expr `thenM` \ (expr', fvExpr) -> - rnRbinds "update" rbinds `thenM` \ (rbinds', fvRbinds) -> - returnM (RecordUpd expr' (HsRecordBinds rbinds') [] [] [], - fvExpr `plusFV` fvRbinds) +rnExpr (RecordUpd expr rbinds _ _ _) + = do { (expr', fvExpr) <- rnLExpr expr + ; (rbinds', fvRbinds) <- rnHsRecFields "update" Nothing rnLExpr HsVar rbinds + ; return (RecordUpd expr' rbinds' [] [] [], + fvExpr `plusFV` fvRbinds) } rnExpr (ExprWithTySig expr pty) = do { (pty', fvTy) <- rnHsTypeFVs doc pty @@ -502,29 +502,6 @@ rnArithSeq (FromThenTo expr1 expr2 expr3) plusFVs [fvExpr1, fvExpr2, fvExpr3]) \end{code} - -%************************************************************************ -%* * -\subsubsection{@Rbinds@s and @Rpats@s: in record expressions} -%* * -%************************************************************************ - -\begin{code} -rnRbinds str rbinds - = mappM_ field_dup_err dup_fields `thenM_` - mapFvRn rn_rbind rbinds `thenM` \ (rbinds', fvRbind) -> - returnM (rbinds', fvRbind) - where - (_, dup_fields) = removeDups cmpLocated [ f | (f,_) <- rbinds ] - - field_dup_err dups = mappM_ (\f -> addLocErr f (dupFieldErr str)) dups - - rn_rbind (field, expr) - = lookupLocatedGlobalOccRn field `thenM` \ fieldname -> - rnLExpr expr `thenM` \ (expr', fvExpr) -> - returnM ((fieldname, expr'), fvExpr `addOneFV` unLoc fieldname) -\end{code} - %************************************************************************ %* * Template Haskell brackets @@ -668,8 +645,8 @@ rnStmt ctxt (RecStmt rec_stmts _ _ _ _) thing_inside doc = text "In a recursive do statement" rnStmt ctxt (ParStmt segs) thing_inside - = do { opt_GlasgowExts <- doptM Opt_GlasgowExts - ; checkM opt_GlasgowExts parStmtErr + = do { parallel_list_comp <- doptM Opt_ParallelListComp + ; checkM parallel_list_comp parStmtErr ; orig_lcl_env <- getLocalRdrEnv ; ((segs',thing), fvs) <- go orig_lcl_env [] segs ; return ((ParStmt segs', thing), fvs) } @@ -958,7 +935,7 @@ patSynErr e = do { addErr (sep [ptext SLIT("Pattern syntax in expression context nest 4 (ppr e)]) ; return (EWildPat, emptyFVs) } -parStmtErr = addErr (ptext SLIT("Illegal parallel list comprehension: use -fglasgow-exts")) +parStmtErr = addErr (ptext SLIT("Illegal parallel list comprehension: use -XParallelListComp")) badIpBinds what binds = hang (ptext SLIT("Implicit-parameter bindings illegal in") <+> what)