[commit: ghc] master: Warn about unused type variables in type families (eb7796f)

git at git.haskell.org git at git.haskell.org
Mon Dec 21 11:59:39 UTC 2015


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

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

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

commit eb7796f13e701cce4e7d1d86f36c966aa17f1e9c
Author: Michał Sośnicki <sosnicki.michal at gmail.com>
Date:   Mon Dec 21 12:29:03 2015 +0100

    Warn about unused type variables in type families
    
    The warnings are enabled with the flag -fwarn-unused-matches, the same
    one that enables warnings on the term level.
    
    Identifiers starting with an underscore are now always parsed as type
    variables.  When the NamedWildCards extension is enabled, the renamer
    replaces those variables with named wildcards.
    
    An additional NameSet nwcs is added to LocalRdrEnv. It's used to keep
    names of the type variables that should be replaced with wildcards.
    
    While renaming HsForAllTy, when a name is explicitly bound it is removed
    from the nwcs NameSet. As a result, the renamer doesn't replace them in
    the quantifier body. (Trac #11098)
    
    Fixes #10982, #11098
    
    Reviewers: alanz, bgamari, hvr, austin, jstolarek
    
    Reviewed By: jstolarek
    
    Subscribers: goldfire, mpickering, RyanGlScott, thomie
    
    Differential Revision: https://phabricator.haskell.org/D1576
    
    GHC Trac Issues: #10982


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

eb7796f13e701cce4e7d1d86f36c966aa17f1e9c
 compiler/basicTypes/RdrName.hs                     |  54 ++++--
 compiler/hsSyn/PlaceHolder.hs                      |  12 +-
 compiler/parser/Parser.y                           |  10 +-
 compiler/parser/RdrHsSyn.hs                        |   1 +
 compiler/rename/RnSource.hs                        |  14 +-
 compiler/rename/RnTypes.hs                         | 199 +++++++++++++++------
 compiler/typecheck/TcTyClsDecls.hs                 |  14 +-
 docs/users_guide/7.12.1-notes.rst                  |   5 +
 docs/users_guide/glasgow_exts.rst                  |  24 ++-
 docs/users_guide/using-warnings.rst                |   3 +-
 libraries/base/Data/Either.hs                      |   2 +-
 libraries/base/Data/Type/Bool.hs                   |  12 +-
 libraries/base/Data/Type/Equality.hs               |  16 +-
 libraries/base/GHC/Generics.hs                     |  18 +-
 libraries/base/GHC/TypeLits.hs                     |   8 +-
 .../tests/determinism/should_compile/determ004.hs  |   6 +-
 testsuite/tests/ghci/scripts/T11098.script         |  13 ++
 testsuite/tests/ghci/scripts/T11098.stdout         |   3 +
 testsuite/tests/ghci/scripts/all.T                 |   1 +
 .../tests/indexed-types/should_compile/T10931.hs   |   2 +-
 .../should_compile/UnusedTyVarWarnings.hs          |  39 ++++
 .../should_compile/UnusedTyVarWarnings.stderr      |  15 ++
 .../should_compile/UnusedTyVarWarningsNamedWCs.hs  |  39 ++++
 .../UnusedTyVarWarningsNamedWCs.stderr             |  12 ++
 testsuite/tests/indexed-types/should_compile/all.T |   2 +
 .../NamedWildcardInDataFamilyInstanceLHS.hs        |   0
 ...=> NamedWildcardInDataFamilyInstanceLHS.stderr} |   7 +-
 .../NamedWildcardInTypeFamilyInstanceLHS.hs        |   2 +-
 .../NamedWildcardInTypeFamilyInstanceLHS.stderr    |  14 ++
 .../should_compile/NamedWildcardsAsTyVars.hs       |  46 +++++
 testsuite/tests/partial-sigs/should_compile/all.T  |   3 +
 .../should_fail/NamedWildcardExplicitForall.hs     |  17 ++
 .../should_fail/NamedWildcardExplicitForall.stderr |  51 ++++++
 .../NamedWildcardInDataFamilyInstanceLHS.stderr    |   4 -
 .../NamedWildcardInTypeFamilyInstanceLHS.stderr    |   4 -
 .../should_fail/NamedWildcardInTypeSplice.stderr   |  10 +-
 .../should_fail/WildcardInADTContext2.stderr       |   4 +-
 testsuite/tests/partial-sigs/should_fail/all.T     |   3 +-
 .../tests/simplCore/should_compile/T10689a.hs      |   4 +-
 39 files changed, 544 insertions(+), 149 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc eb7796f13e701cce4e7d1d86f36c966aa17f1e9c


More information about the ghc-commits mailing list