[commit: ghc] wip/redundant-constraints: Major patch to add -fwarn-redundant-constraints (440e39e)

git at git.haskell.org git at git.haskell.org
Mon Jan 5 15:01:32 UTC 2015


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

On branch  : wip/redundant-constraints
Link       : http://ghc.haskell.org/trac/ghc/changeset/440e39e603d3a2da4b5472e5c2a43dc6f66bfb61/ghc

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

commit 440e39e603d3a2da4b5472e5c2a43dc6f66bfb61
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Jan 5 13:20:48 2015 +0000

    Major patch to add -fwarn-redundant-constraints
    
    The idea was promted by Trac #9939, but it was Christmas, so I did
    some recreational programming that went much further.
    
    The idea is to warn when a constraint in a user-supplied context is
    redundant.  Everything is described in detail in
      Note [Tracking redundant constraints]
    in TcSimplify.
    
    Main changes:
    
     * The new ic_status field in an implication, of type ImplicStatus.
       It replaces ic_insol, and includes information about redundant
       constraints.
    
     * New function TcSimplify.setImplicationStatus sets the ic_status.
    
     * TcSigInfo has sig_report_redundant field to say whenther a
       redundant constraint should be reported; and similarly
       the FunSigCtxt constructor of UserTypeCtxt
    
     * EvBinds has a field eb_is_given, to record whether it is a given
       or wanted binding. Some consequential chagnes to creating an evidence
       binding (so that we record whether it is given or wanted).
    
     * AbsBinds field abs_ev_binds is now a *list* of TcEvBiinds;
       see Note [Typechecking plan for instance declarations] in
       TcInstDcls
    
     * Some significant changes to the type checking of instance
       declarations; Note [Typechecking plan for instance declarations]
       in TcInstDcls.
    
     * I found that TcErrors.relevantBindings was failing to zonk the
       origin of the constraint it was looking at, and hence failing to
       find some relevant bindings.  Easy to fix, and orthogonal to
       everything else, but hard to disentangle.
    
    Some minor refactorig:
    
     * TcMType.newSimpleWanteds moves to Inst, renamed as newWanteds
    
     * TcClassDcl and TcInstDcls now have their own code for typechecking
       a method body, rather than sharing a single function. The shared
       function (ws TcClassDcl.tcInstanceMethodBody) didn't have much code
       and the differences were growing confusing.
    
     * Add new function TcRnMonad.pushLevelAndCaptureConstraints, and
       use it
    
     * Add new function Bag.catBagMaybes, and use it in TcSimplify


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

440e39e603d3a2da4b5472e5c2a43dc6f66bfb61
 compiler/basicTypes/BasicTypes.hs  |   2 +
 compiler/deSugar/DsArrows.hs       |   4 +-
 compiler/deSugar/DsBinds.hs        |  27 +-
 compiler/deSugar/DsExpr.hs         |   2 +-
 compiler/hsSyn/HsBinds.hs          |   9 +-
 compiler/iface/BuildTyCl.hs        |   2 +-
 compiler/iface/IfaceSyn.hs         |   2 +-
 compiler/main/DynFlags.hs          |   7 +-
 compiler/typecheck/Inst.hs         |  18 +-
 compiler/typecheck/TcBinds.hs      |  52 ++-
 compiler/typecheck/TcCanonical.hs  |  30 +-
 compiler/typecheck/TcClassDcl.hs   | 133 +++----
 compiler/typecheck/TcDeriv.hs      |   2 +-
 compiler/typecheck/TcErrors.hs     | 244 +++++++-----
 compiler/typecheck/TcEvidence.hs   |  42 ++-
 compiler/typecheck/TcFlatten.hs    |   6 +-
 compiler/typecheck/TcHsSyn.hs      |  31 +-
 compiler/typecheck/TcInstDcls.hs   | 751 ++++++++++++++++++++++---------------
 compiler/typecheck/TcInteract.hs   |  63 ++--
 compiler/typecheck/TcMType.hs      |  35 +-
 compiler/typecheck/TcMatches.hs    |   2 +-
 compiler/typecheck/TcPat.hs        |  29 +-
 compiler/typecheck/TcPatSyn.hs     |  16 +-
 compiler/typecheck/TcRnDriver.hs   |   5 +-
 compiler/typecheck/TcRnMonad.hs    |  33 +-
 compiler/typecheck/TcRnTypes.hs    |  79 +++-
 compiler/typecheck/TcRules.hs      |  36 +-
 compiler/typecheck/TcSMonad.hs     |  42 ++-
 compiler/typecheck/TcSimplify.hs   | 270 +++++++++++--
 compiler/typecheck/TcTyClsDecls.hs |   6 +-
 compiler/typecheck/TcType.hs       |  18 +-
 compiler/typecheck/TcUnify.hs      |  37 +-
 compiler/typecheck/TcValidity.hs   |   2 +-
 compiler/utils/Bag.hs              |  15 +-
 compiler/utils/Util.hs             |   2 +
 35 files changed, 1271 insertions(+), 783 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 440e39e603d3a2da4b5472e5c2a43dc6f66bfb61


More information about the ghc-commits mailing list