Fix renaming of guards
authorSimon Peyton Jones <simonpj@microsoft.com>
Mon, 9 May 2011 15:45:12 +0000 (16:45 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Mon, 9 May 2011 15:45:12 +0000 (16:45 +0100)
This was making mc17 fail.

compiler/hsSyn/HsExpr.lhs
compiler/rename/RnExpr.lhs

index 9c88783..dd33cae 100644 (file)
@@ -1274,10 +1274,12 @@ data HsStmtContext id
 \begin{code}
 isListCompExpr :: HsStmtContext id -> Bool
 -- Uses syntax [ e | quals ]
-isListCompExpr ListComp  = True
-isListCompExpr PArrComp  = True
-isListCompExpr MonadComp = True
-isListCompExpr _         = False
+isListCompExpr ListComp         = True
+isListCompExpr PArrComp         = True
+isListCompExpr MonadComp        = True  
+isListCompExpr (ParStmtCtxt c)   = isListCompExpr c
+isListCompExpr (TransStmtCtxt c) = isListCompExpr c
+isListCompExpr _                 = False
 
 isMonadCompExpr :: HsStmtContext id -> Bool
 isMonadCompExpr MonadComp            = True
index 46eef67..88e0462 100644 (file)
@@ -694,6 +694,8 @@ rnStmt ctxt (L loc (ExprStmt expr _ _ _)) thing_inside
                               then lookupStmtName ctxt guardMName
                              else return (noSyntaxExpr, emptyFVs)
                              -- Only list/parr/monad comprehensions use 'guard'
+                             -- Also for sub-stmts of same eg [ e | x<-xs, gd | blah ]
+                             -- Here "gd" is a guard
        ; (thing, fvs3)    <- thing_inside []
        ; return (([L loc (ExprStmt expr' then_op guard_op placeHolderType)], thing),
                  fv_expr `plusFV` fvs1 `plusFV` fvs2 `plusFV` fvs3) }