[commit: ghc] ghc-8.0: Avoid running afoul of the zipTvSubst check. (4bcec82)

git at git.haskell.org git at git.haskell.org
Thu Mar 24 00:52:37 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/4bcec82c560acddde024575842efe82736f4ed3b/ghc

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

commit 4bcec82c560acddde024575842efe82736f4ed3b
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date:   Mon Mar 21 22:35:41 2016 -0400

    Avoid running afoul of the zipTvSubst check.
    
    addDataConStupidTheta includes comments that the types list
    might be longer than the tvs list. And the check in zipTvSubst
    doesn't appear to be terribly recent. I am utterly flummoxed
    as to why this worked before. It was clearly just broken.
    And now it's fixed.
    
    (cherry picked from commit 0beb82c171913508dc0de91851ab8e90821d8ba8)


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

4bcec82c560acddde024575842efe82736f4ed3b
 compiler/typecheck/TcPat.hs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/compiler/typecheck/TcPat.hs b/compiler/typecheck/TcPat.hs
index 53b8142..6cc6429 100644
--- a/compiler/typecheck/TcPat.hs
+++ b/compiler/typecheck/TcPat.hs
@@ -1017,7 +1017,8 @@ addDataConStupidTheta data_con inst_tys
         -- The origin should always report "occurrence of C"
         -- even when C occurs in a pattern
     stupid_theta = dataConStupidTheta data_con
-    tenv = zipTvSubst (dataConUnivTyVars data_con) inst_tys
+    univ_tvs     = dataConUnivTyVars data_con
+    tenv = zipTvSubst univ_tvs (takeList univ_tvs inst_tys)
          -- NB: inst_tys can be longer than the univ tyvars
          --     because the constructor might have existentials
     inst_theta = substTheta tenv stupid_theta



More information about the ghc-commits mailing list