[commit: ghc] wip/rae: Avoid running afoul of the zipTvSubst check. (0beb82c)

git at git.haskell.org git at git.haskell.org
Tue Mar 22 02:41:06 UTC 2016


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

On branch  : wip/rae
Link       : http://ghc.haskell.org/trac/ghc/changeset/0beb82c171913508dc0de91851ab8e90821d8ba8/ghc

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

commit 0beb82c171913508dc0de91851ab8e90821d8ba8
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.


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

0beb82c171913508dc0de91851ab8e90821d8ba8
 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