[commit: ghc] supercompiler: Revert state in MSG if binderisation fails (7181cc0)

Max Bolingbroke <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : supercompiler

http://hackage.haskell.org/trac/ghc/changeset/7181cc09f46ed51c54821cc01fb4939bfe2b4670

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

commit 7181cc09f46ed51c54821cc01fb4939bfe2b4670
Author: Max Bolingbroke <[email protected]>
Date:   Thu Oct 4 14:58:53 2012 +0100

    Revert state in MSG if binderisation fails

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

 compiler/supercompile/Supercompile/Drive/MSG.hs |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/compiler/supercompile/Supercompile/Drive/MSG.hs b/compiler/supercompile/Supercompile/Drive/MSG.hs
index 6fcb4e4..3736fc0 100644
--- a/compiler/supercompile/Supercompile/Drive/MSG.hs
+++ b/compiler/supercompile/Supercompile/Drive/MSG.hs
@@ -233,7 +233,8 @@ msgPendStackBinder x_looped x_l x_r = State.state $ \(iss, known) -> let x0 = za
 msgPend :: RnEnv2 -> Var -> Pending -> MSG Var {- partial loop -}
 msgPend rn2 x0 pending = MSG $ \e s0 -> case lookupUpdatePending s0 of
     Right x                       -> (s0, pure x)
-    Left (mb_eq, binderise, mk_s) -> res
+    Left (mb_eq, binderise, mk_s) -> case res of (_,  Left msg) -> (s0, Left msg)
+                                                 (s3, Right x)  -> (s3, Right x)  -- NB: must revert state or else x_looped will be in the msgKnownVars, and pulling on it will fail the irrefutible pattern match
       where -- The use of s here is necessary to ensure we only allocate a given common var once
             extra_iss | Just eq <- mb_eq
                       , eq `elemInScopeSet` msgCommonHeapVars (msgMode e)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.