[commit: ghc] master: Use substTyUnchecked in TcMType.new_meta_tv_x (f4a14d6)

git at git.haskell.org git at git.haskell.org
Wed Nov 2 12:34:05 UTC 2016


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

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

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

commit f4a14d6c535bdf52b19f441fe185ea13d62fdc24
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Wed Nov 2 11:50:10 2016 +0000

    Use substTyUnchecked in TcMType.new_meta_tv_x
    
    Sadly, one of the indirect callers of this function doesn't yet
    enforce the in-scope set.  It's in the TcHsType.tc_infer_args swamp,
    so I'm not going to wade in there today.
    
    The assertion tripped when investigating Trac #12785; but this patch
    does NOT fix the actual bug reported there.


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

f4a14d6c535bdf52b19f441fe185ea13d62fdc24
 compiler/typecheck/TcMType.hs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs
index a290047..0892f64 100644
--- a/compiler/typecheck/TcMType.hs
+++ b/compiler/typecheck/TcMType.hs
@@ -806,7 +806,12 @@ new_meta_tv_x info subst tv
         ; details <- newMetaDetails info
         ; let name   = mkSystemName uniq (getOccName tv)
                        -- See Note [Name of an instantiated type variable]
-              kind   = substTy subst (tyVarKind tv)
+              kind   = substTyUnchecked subst (tyVarKind tv)
+                       -- Unchecked because we call newMetaTyVarX from
+                       -- tcInstBinderX, which is called from tc_infer_args
+                       -- which does not yet take enough trouble to ensure
+                       -- the in-scope set is right; e.g. Trac #12785 trips
+                       -- if we use substTy here
               new_tv = mkTcTyVar name kind details
               subst1 = extendTvSubstWithClone subst tv new_tv
         ; return (subst1, new_tv) }



More information about the ghc-commits mailing list