[commit: ghc] ghc-8.2: Fix the in-scope set in TcHsType.instantiateTyN (c1de075)

git at git.haskell.org git at git.haskell.org
Thu Jun 29 23:31:34 UTC 2017


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

On branch  : ghc-8.2
Link       : http://ghc.haskell.org/trac/ghc/changeset/c1de0758157097c47de2787c46030174744422b6/ghc

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

commit c1de0758157097c47de2787c46030174744422b6
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Wed Jun 28 12:32:48 2017 +0100

    Fix the in-scope set in TcHsType.instantiateTyN
    
    See Trac #13879
    
    (cherry picked from commit 4bdac331207e10650da9d3bf1b446bc8be3c069a)


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

c1de0758157097c47de2787c46030174744422b6
 compiler/typecheck/TcHsType.hs | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs
index 357ffbc..f2369fe 100644
--- a/compiler/typecheck/TcHsType.hs
+++ b/compiler/typecheck/TcHsType.hs
@@ -56,7 +56,7 @@ import TcIface
 import TcSimplify ( solveEqualities )
 import TcType
 import TcHsSyn( zonkSigType )
-import Inst   ( tcInstBinders, tcInstBindersX, tcInstBinderX )
+import Inst   ( tcInstBindersX, tcInstBinderX )
 import Type
 import Kind
 import RdrName( lookupLocalRdrOcc )
@@ -928,11 +928,16 @@ instantiateTyN n ty ki
         num_to_inst                  = length bndrs - n
            -- NB: splitAt is forgiving with invalid numbers
         (inst_bndrs, leftover_bndrs) = splitAt num_to_inst bndrs
+        empty_subst = mkEmptyTCvSubst (mkInScopeSet (tyCoVarsOfType ki))
     in
     if num_to_inst <= 0 then return (ty, ki) else
-    do { (subst, inst_args) <- tcInstBinders inst_bndrs
+    do { (subst, inst_args) <- tcInstBindersX empty_subst Nothing inst_bndrs
        ; let rebuilt_ki = mkPiTys leftover_bndrs inner_ki
              ki'        = substTy subst rebuilt_ki
+       ; traceTc "instantiateTyN" (vcat [ ppr ty <+> dcolon <+> ppr ki
+                                        , ppr subst
+                                        , ppr rebuilt_ki
+                                        , ppr ki' ])
        ; return (mkNakedAppTys ty inst_args, ki') }
 
 ---------------------------



More information about the ghc-commits mailing list