Merge remote branch 'origin/master'
authorSimon Peyton Jones <simonpj@microsoft.com>
Wed, 4 May 2011 22:10:42 +0000 (23:10 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Wed, 4 May 2011 22:10:42 +0000 (23:10 +0100)
compiler/deSugar/Check.lhs
compiler/rename/RnExpr.lhs
compiler/typecheck/TcSMonad.lhs

index fa85a1d..d894179 100644 (file)
@@ -110,8 +110,7 @@ type EqnSet = UniqSet EqnNo
 check :: [EquationInfo] -> ([ExhaustivePat], [EquationInfo])
   -- Second result is the shadowed equations
   -- if there are view patterns, just give up - don't know what the function is
-check qs = pprTrace "check" (ppr tidy_qs) $
-           (untidy_warns, shadowed_eqns)
+check qs = (untidy_warns, shadowed_eqns)
       where
         tidy_qs = map tidy_eqn qs
        (warns, used_nos) = check' ([1..] `zip` tidy_qs)
index b3458db..46eef67 100644 (file)
@@ -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]
index 414c63a..63b3bb8 100644 (file)
@@ -101,13 +101,13 @@ import FastString
 
 import HsBinds               -- for TcEvBinds stuff 
 import Id 
-
-import StaticFlags( opt_PprStyle_Debug )
 import TcRnTypes
+import Data.IORef
+
 #ifdef DEBUG
+import StaticFlags( opt_PprStyle_Debug )
 import Control.Monad( when )
 #endif
-import Data.IORef
 \end{code}