[commit: ghc] wip/new-flatten-skolems-Aug14: Don't freshen the dfun tyvars in newClsInst (a58aca0)

git at git.haskell.org git at git.haskell.org
Tue Oct 7 12:37:56 UTC 2014


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

On branch  : wip/new-flatten-skolems-Aug14
Link       : http://ghc.haskell.org/trac/ghc/changeset/a58aca000a60dc9db73231c1fbabc7ee72c5c324/ghc

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

commit a58aca000a60dc9db73231c1fbabc7ee72c5c324
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Oct 7 13:37:30 2014 +0100

    Don't freshen the dfun tyvars in newClsInst
    
    (they scope over the binds; show up when compiling GHC.Ord)


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

a58aca000a60dc9db73231c1fbabc7ee72c5c324
 compiler/typecheck/Inst.lhs | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/compiler/typecheck/Inst.lhs b/compiler/typecheck/Inst.lhs
index 058772f..7ec127c 100644
--- a/compiler/typecheck/Inst.lhs
+++ b/compiler/typecheck/Inst.lhs
@@ -415,11 +415,10 @@ newClsInst overlap_mode dfun_name tvs theta clas tys
   = do { (subst, tvs') <- freshenTyVarBndrs tvs
              -- Be sure to freshen those type variables,
              -- so they are sure not to appear in any lookup
-       ; let theta' = substTheta subst theta
-             tys'   = substTys subst tys
-             dfun   = mkDictFunId dfun_name tvs' theta' clas tys'
-                      -- We don't really need to substitute in the dfun's type,
-                      -- but it avoids gratuitous differences if we do so
+       ; let tys'   = substTys subst tys
+             dfun   = mkDictFunId dfun_name tvs theta clas tys
+                      -- We don't substitute in the dfun's type,
+                      -- because those tvs may scope over the bindings
        ; oflag <- getOverlapFlag overlap_mode
        ; return (mkLocalInstance dfun oflag tvs' clas tys') }
 



More information about the ghc-commits mailing list