Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/d4780d48bb8a665a2cdaa5e2c6e4bfbc87298fd0

>---------------------------------------------------------------

commit d4780d48bb8a665a2cdaa5e2c6e4bfbc87298fd0
Author: Simon Peyton Jones <[email protected]>
Date:   Wed May 4 23:09:53 2011 +0100

    Do-notation in an arrow context is not rebindable
    
    Fixes Trac #4851

>---------------------------------------------------------------

 compiler/rename/RnExpr.lhs |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/compiler/rename/RnExpr.lhs b/compiler/rename/RnExpr.lhs
index b3458db..46eef67 100644
--- a/compiler/rename/RnExpr.lhs
+++ b/compiler/rename/RnExpr.lhs
@@ -841,9 +841,24 @@ rnParallelStmts ctxt segs thing_inside
 
 lookupStmtName :: HsStmtContext Name -> Name -> RnM (HsExpr Name, FreeVars)
 -- Like lookupSyntaxName, but ListComp/PArrComp are never rebindable
-lookupStmtName ListComp n = return (HsVar n, emptyFVs)
-lookupStmtName PArrComp n = return (HsVar n, emptyFVs)
-lookupStmtName _        n = lookupSyntaxName n
+-- Neither is ArrowExpr, which has its own desugarer in DsArrows
+lookupStmtName ctxt n 
+  = case ctxt of
+      ListComp        -> not_rebindable
+      PArrComp        -> not_rebindable
+      ArrowExpr       -> not_rebindable
+      PatGuard {}     -> not_rebindable
+
+      DoExpr          -> rebindable
+      MDoExpr         -> rebindable
+      MonadComp       -> rebindable
+      GhciStmt        -> rebindable   -- I suppose?
+
+      ParStmtCtxt   c -> lookupStmtName c n    -- Look inside to
+      TransStmtCtxt c -> lookupStmtName c n    -- the parent context
+  where
+    rebindable     = lookupSyntaxName n
+    not_rebindable = return (HsVar n, emptyFVs)
 \end{code}
 
 Note [Renaming parallel Stmts]



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to