[commit: ghc] master: Fix the in-scope set in TcHsType.instantiateTyN (4bdac33)

git at git.haskell.org git at git.haskell.org
Wed Jun 28 13:09:40 UTC 2017


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

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

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

commit 4bdac331207e10650da9d3bf1b446bc8be3c069a
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


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

4bdac331207e10650da9d3bf1b446bc8be3c069a
 compiler/typecheck/TcHsType.hs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs
index 46b306d..7c8a89a 100644
--- a/compiler/typecheck/TcHsType.hs
+++ b/compiler/typecheck/TcHsType.hs
@@ -929,11 +929,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