[commit: ghc] master: Minor fix to free-vars in RnTypes (cc0dba1)

git at git.haskell.org git at git.haskell.org
Fri Jun 26 07:32:58 UTC 2015


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

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

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

commit cc0dba1e4da6857a740b866d3f8a12d8549dc452
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Wed Jun 24 23:29:11 2015 +0100

    Minor fix to free-vars in RnTypes
    
    A type wild-card should't appear in the "uses"
    free-variable set.


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

cc0dba1e4da6857a740b866d3f8a12d8549dc452
 compiler/rename/RnTypes.hs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/compiler/rename/RnTypes.hs b/compiler/rename/RnTypes.hs
index 743f460..3766ed1 100644
--- a/compiler/rename/RnTypes.hs
+++ b/compiler/rename/RnTypes.hs
@@ -285,7 +285,9 @@ rnHsTyKi isType _doc (HsWildCardTy (AnonWildCard PlaceHolder))
     do { loc <- getSrcSpanM
        ; uniq <- newUnique
        ; let name = mkInternalName uniq (mkTyVarOcc "_") loc
-       ; return (HsWildCardTy (AnonWildCard name), unitFV name) }
+       ; return (HsWildCardTy (AnonWildCard name), emptyFVs) }
+         -- emptyFVs: this occurrence does not refer to a
+         --           binding, so don't treat it as a free variable
 
 rnHsTyKi isType doc (HsWildCardTy (NamedWildCard rdr_name))
   = ASSERT( isType )
@@ -297,7 +299,9 @@ rnHsTyKi isType doc (HsWildCardTy (NamedWildCard rdr_name))
          failWith $ text "Unexpected wild card:" <+> quotes (ppr rdr_name) $$
                     docOfHsDocContext doc
        ; name <- rnTyVar isType rdr_name
-       ; return (HsWildCardTy (NamedWildCard name), unitFV name) }
+       ; return (HsWildCardTy (NamedWildCard name), emptyFVs) }
+         -- emptyFVs: this occurrence does not refer to a
+         --           binding, so don't treat it as a free variable
 
 --------------
 rnHsTyKiForAll :: Bool -> HsDocContext -> HsType RdrName



More information about the ghc-commits mailing list