[commit: ghc] wip/ttypeable: TcTypeable: Fix kind variable count (529bbc9)

git at git.haskell.org git at git.haskell.org
Sun Jan 29 20:21:50 UTC 2017


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

On branch  : wip/ttypeable
Link       : http://ghc.haskell.org/trac/ghc/changeset/529bbc9eebbaa495965879da423d683805d844b8/ghc

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

commit 529bbc9eebbaa495965879da423d683805d844b8
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Sat Jan 28 02:24:10 2017 -0500

    TcTypeable: Fix kind variable count


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

529bbc9eebbaa495965879da423d683805d844b8
 compiler/typecheck/TcTypeable.hs         | 4 ++--
 libraries/base/Data/Typeable/Internal.hs | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/compiler/typecheck/TcTypeable.hs b/compiler/typecheck/TcTypeable.hs
index c3e9b21..e35a27c 100644
--- a/compiler/typecheck/TcTypeable.hs
+++ b/compiler/typecheck/TcTypeable.hs
@@ -342,11 +342,11 @@ mkTyConRepTyConRHS stuff@(Stuff {..}) todo tycon
                      `nlHsApp` nlHsLit (word64 low)
                      `nlHsApp` mod_rep_expr todo
                      `nlHsApp` trNameLit (mkFastString tycon_str)
-                     `nlHsApp` nlHsLit (int 0) -- TODO
+                     `nlHsApp` nlHsLit (int n_kind_vars)
                      `nlHsApp` kind_rep
        return rep_rhs
   where
-
+    n_kind_vars = length $ filter isNamedTyConBinder (tyConBinders tycon)
     tycon_str = add_tick (occNameString (getOccName tycon))
     add_tick s | isPromotedDataCon tycon = '\'' : s
                | otherwise               = s
diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs
index 7264b1d..4448fcb 100644
--- a/libraries/base/Data/Typeable/Internal.hs
+++ b/libraries/base/Data/Typeable/Internal.hs
@@ -329,9 +329,8 @@ typeRepKind _ = error "Ill-kinded type representation"
 tyConKind :: TyCon ->  [SomeTypeRep] -> SomeTypeRep
 tyConKind (TyCon _ _ _ _ nKindVars# kindRep) kindVars = go kindRep
   where
-    nKindVars = I# nKindVars#
     kindVarsArr :: A.Array KindBndr SomeTypeRep
-    kindVarsArr = A.listArray (0,nKindVars) kindVars
+    kindVarsArr = A.listArray (0, I# (nKindVars# -# 1#)) kindVars
 
     go :: KindRep -> SomeTypeRep
     go (KindRepTyConApp tc args) = undefined -- tyConKind tc args



More information about the ghc-commits mailing list