FW: [commit: ghc] master: Add missing kind-check for tcEqType on forall-types (74894e0)

Simon Peyton Jones simonpj at microsoft.com
Mon Mar 24 10:30:33 UTC 2014


Austin, this one looks like a bug waiting to happen, so let's merge if time.

Simon

-----Original Message-----
From: ghc-commits [mailto:ghc-commits-bounces at haskell.org] On Behalf Of git at git.haskell.org
Sent: 24 March 2014 10:27
To: ghc-commits at haskell.org
Subject: [commit: ghc] master: Add missing kind-check for tcEqType on forall-types (74894e0)

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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/74894e0bc405247092e865b9541f5f18d26aa015/ghc

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

commit 74894e0bc405247092e865b9541f5f18d26aa015
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Mar 21 15:24:49 2014 +0000

    Add missing kind-check for tcEqType on forall-types
    
    This wasn't showing up as a bug, but it was definitely wrong.


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

74894e0bc405247092e865b9541f5f18d26aa015
 compiler/typecheck/TcType.lhs |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/compiler/typecheck/TcType.lhs b/compiler/typecheck/TcType.lhs index 9b58b4c..08c7a62 100644
--- a/compiler/typecheck/TcType.lhs
+++ b/compiler/typecheck/TcType.lhs
@@ -245,7 +245,6 @@ checking.  It's attached to mutable type variables only.
 It's knot-tied back to Var.lhs.  There is no reason in principle  why Var.lhs shouldn't actually have the definition, but it "belongs" here.
 
-
 Note [Signature skolems]
 ~~~~~~~~~~~~~~~~~~~~~~~~
 Consider this
@@ -1008,7 +1007,8 @@ tcEqType ty1 ty2
                  | Just t2' <- tcView t2 = go env t1 t2'
     go env (TyVarTy tv1)       (TyVarTy tv2)     = rnOccL env tv1 == rnOccR env tv2
     go _   (LitTy lit1)        (LitTy lit2)      = lit1 == lit2
-    go env (ForAllTy tv1 t1)   (ForAllTy tv2 t2) = go (rnBndr2 env tv1 tv2) t1 t2
+    go env (ForAllTy tv1 t1)   (ForAllTy tv2 t2) = go env (tyVarKind tv1) (tyVarKind tv2)
+                                                && go (rnBndr2 env tv1 
+ tv2) t1 t2
     go env (AppTy s1 t1)       (AppTy s2 t2)     = go env s1 s2 && go env t1 t2
     go env (FunTy s1 t1)       (FunTy s2 t2)     = go env s1 s2 && go env t1 t2
     go env (TyConApp tc1 ts1) (TyConApp tc2 ts2) = (tc1 == tc2) && gos env ts1 ts2 @@ -1027,7 +1027,8 @@ pickyEqType ty1 ty2
     init_env = mkRnEnv2 (mkInScopeSet (tyVarsOfType ty1 `unionVarSet` tyVarsOfType ty2))
     go env (TyVarTy tv1)       (TyVarTy tv2)     = rnOccL env tv1 == rnOccR env tv2
     go _   (LitTy lit1)        (LitTy lit2)      = lit1 == lit2
-    go env (ForAllTy tv1 t1)   (ForAllTy tv2 t2) = go (rnBndr2 env tv1 tv2) t1 t2
+    go env (ForAllTy tv1 t1)   (ForAllTy tv2 t2) = go env (tyVarKind tv1) (tyVarKind tv2)
+                                                && go (rnBndr2 env tv1 
+ tv2) t1 t2
     go env (AppTy s1 t1)       (AppTy s2 t2)     = go env s1 s2 && go env t1 t2
     go env (FunTy s1 t1)       (FunTy s2 t2)     = go env s1 s2 && go env t1 t2
     go env (TyConApp tc1 ts1) (TyConApp tc2 ts2) = (tc1 == tc2) && gos env ts1 ts2

_______________________________________________
ghc-commits mailing list
ghc-commits at haskell.org
http://www.haskell.org/mailman/listinfo/ghc-commits


More information about the ghc-devs mailing list