[project @ 2002-09-25 16:00:50 by simonmar]
authorsimonmar <unknown>
Wed, 25 Sep 2002 16:00:50 +0000 (16:00 +0000)
committersimonmar <unknown>
Wed, 25 Sep 2002 16:00:50 +0000 (16:00 +0000)
When a command-line evaluation returns an exception, revert to the old
interactive context, because the new context will bind 'it' to a name
that doesn't exist in the linker's symbol table.

ghc/compiler/compMan/CompManager.lhs

index 64b332e..3b3a2aa 100644 (file)
@@ -319,8 +319,11 @@ cmRunStmt cmstate@CmState{ hpt=hpt, pcs=pcs, ic=icontext }
 
                case either_hvals of
                    Left e -> do
-                       return ( cmstate{ pcs=new_pcs, ic=new_ic }, 
-                                CmRunException e )
+                       -- on error, keep the *old* interactive context,
+                       -- so that 'it' is not bound to something
+                       -- that doesn't exist.
+                       return ( cmstate{ pcs=new_pcs }, CmRunException e )
+
                    Right hvals -> do
                        -- Get the newly bound things, and bind them.  
                        -- Don't need to delete any shadowed bindings;