[commit: ghc] master: Add a clarifying comment about scoping of type variables in associated type decls (c973c70)

git at git.haskell.org git at git.haskell.org
Mon Jul 14 21:23:05 UTC 2014


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

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

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

commit c973c70a2147358e0f5489a2906723fd2ef3fc33
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Wed Jul 2 23:05:52 2014 +0100

    Add a clarifying comment about scoping of type variables in associated type decls


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

c973c70a2147358e0f5489a2906723fd2ef3fc33
 compiler/typecheck/TcHsType.lhs | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/compiler/typecheck/TcHsType.lhs b/compiler/typecheck/TcHsType.lhs
index eb3dd32..723206b 100644
--- a/compiler/typecheck/TcHsType.lhs
+++ b/compiler/typecheck/TcHsType.lhs
@@ -1307,6 +1307,11 @@ tcTyClTyVars tycon (HsQTvs { hsq_kvs = hs_kvs, hsq_tvs = hs_tvs }) thing_inside
        ; tvs <- zipWithM tc_hs_tv hs_tvs kinds
        ; tcExtendTyVarEnv tvs (thing_inside (kvs ++ tvs) res) }
   where
+    -- In the case of associated types, the renamer has
+    -- ensured that the names are in commmon
+    -- e.g.   class C a_29 where
+    --           type T b_30 a_29 :: *
+    -- Here the a_29 is shared
     tc_hs_tv (L _ (UserTyVar n))        kind = return (mkTyVar n kind)
     tc_hs_tv (L _ (KindedTyVar n hs_k)) kind = do { tc_kind <- tcLHsKind hs_k
                                                   ; checkKind kind tc_kind



More information about the ghc-commits mailing list