[commit: ghc] master: Compute InScopeSet in substInteractiveContext (e19b646)

git at git.haskell.org git at git.haskell.org
Tue Dec 26 12:29:46 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/e19b6464cc8ea498775074a680f91d3e5b5636d3/ghc

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

commit e19b6464cc8ea498775074a680f91d3e5b5636d3
Author: Bartosz Nitka <niteria at gmail.com>
Date:   Tue Dec 26 12:28:39 2017 +0000

    Compute InScopeSet in substInteractiveContext
    
    It doesn't look like we keep any sets of free variables
    of the types of Ids handy, so we just have to build them
    when doing a substitution.
    
    Test Plan: buildbot + run testsuite with debug
    
    Reviewers: simonmar, simonpj, austin, bgamari
    
    Reviewed By: simonpj
    
    Subscribers: carter, rwbarton, thomie
    
    GHC Trac Issues: #11371
    
    Differential Revision: https://phabricator.haskell.org/D3431


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

e19b6464cc8ea498775074a680f91d3e5b5636d3
 compiler/main/HscTypes.hs | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs
index 16c8002..165f860 100644
--- a/compiler/main/HscTypes.hs
+++ b/compiler/main/HscTypes.hs
@@ -1711,8 +1711,13 @@ substInteractiveContext ictxt at InteractiveContext{ ic_tythings = tts } subst
   | isEmptyTCvSubst subst = ictxt
   | otherwise             = ictxt { ic_tythings = map subst_ty tts }
   where
-    subst_ty (AnId id) = AnId $ id `setIdType` substTyUnchecked subst (idType id)
-    subst_ty tt        = tt
+    subst_ty (AnId id)
+      = AnId $ id `setIdType` substTyAddInScope subst (idType id)
+      -- Variables in the interactive context *can* mention free type variables
+      -- because of the runtime debugger. Otherwise you'd expect all
+      -- variables bound in the interactive context to be closed.
+    subst_ty tt
+      = tt
 
 instance Outputable InteractiveImport where
   ppr (IIModule m) = char '*' <> ppr m



More information about the ghc-commits mailing list