[commit: ghc] master: Use the right environment for tidying the types of a data constructor (b350ac5)

Simon Peyton Jones <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/b350ac5874fb413f578c9d3977d24193f8d3308d

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

commit b350ac5874fb413f578c9d3977d24193f8d3308d
Author: Simon Peyton Jones <[email protected]>
Date:   Fri Nov 23 16:57:57 2012 +0000

    Use the right environment for tidying the types of a data constructor
    
    Fixes Trac #7438

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

 compiler/iface/MkIface.lhs |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs
index bf8edc4..b27c7c6 100644
--- a/compiler/iface/MkIface.lhs
+++ b/compiler/iface/MkIface.lhs
@@ -1502,16 +1502,19 @@ tyConToIfaceDecl env tycon
                     ifConUnivTvs = toIfaceTvBndrs univ_tvs',
                     ifConExTvs   = toIfaceTvBndrs ex_tvs',
                     ifConEqSpec  = to_eq_spec eq_spec,
-                    ifConCtxt    = tidyToIfaceContext env3 theta,
-                    ifConArgTys  = map (tidyToIfaceType env3) arg_tys,
+                    ifConCtxt    = tidyToIfaceContext env2 theta,
+                    ifConArgTys  = map (tidyToIfaceType env2) arg_tys,
                     ifConFields  = map getOccName 
                                        (dataConFieldLabels data_con),
                     ifConStricts = dataConStrictMarks data_con }
         where
           (univ_tvs, ex_tvs, eq_spec, theta, arg_tys, _) = dataConFullSig data_con
-          (env2, univ_tvs') = tidyTyClTyVarBndrs env1 univ_tvs
-          (env3, ex_tvs')   = tidyTyVarBndrs env2 ex_tvs
-          to_eq_spec spec = [ (getOccName (tidyTyVar env3 tv), tidyToIfaceType env3 ty) 
+
+          -- Start with 'emptyTidyEnv' not 'env1', because the type of the
+          -- data constructor is fully standalone
+          (env1, univ_tvs') = tidyTyVarBndrs emptyTidyEnv univ_tvs
+          (env2, ex_tvs')   = tidyTyVarBndrs env1 ex_tvs
+          to_eq_spec spec = [ (getOccName (tidyTyVar env2 tv), tidyToIfaceType env2 ty) 
                             | (tv,ty) <- spec]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.