[commit: ghc] master: Major patch to add -fwarn-redundant-constraints (32973bf)
git at git.haskell.org
git at git.haskell.org
Tue Jan 6 15:10:17 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/32973bf3c2f6fe00e01b44a63ac1904080466938/ghc
>---------------------------------------------------------------
commit 32973bf3c2f6fe00e01b44a63ac1904080466938
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
>---------------------------------------------------------------
32973bf3c2f6fe00e01b44a63ac1904080466938
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 | 139 ++--
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 | 80 ++-
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 +
docs/users_guide/using.xml | 32 +
testsuite/tests/arrows/should_compile/arrowpat.hs | 3 +-
testsuite/tests/codeGen/should_compile/T3286.hs | 1 +
testsuite/tests/deriving/should_compile/T2856.hs | 1 +
testsuite/tests/deriving/should_compile/T4966.hs | 2 +
.../tests/deriving/should_compile/T4966.stderr | 4 +-
.../tests/deriving/should_compile/deriving-1935.hs | 2 +
.../deriving/should_compile/deriving-1935.stderr | 6 +-
testsuite/tests/deriving/should_compile/drv001.hs | 2 +
testsuite/tests/deriving/should_compile/drv002.hs | 2 +
testsuite/tests/deriving/should_compile/drv003.hs | 2 +
.../tests/deriving/should_compile/drv003.stderr | 4 +-
testsuite/tests/deriving/should_run/T9576.stderr | 2 +-
testsuite/tests/gadt/Gadt17_help.hs | 2 +-
testsuite/tests/ghci/scripts/T5045.hs | 1 +
testsuite/tests/ghci/scripts/T8357.hs | 1 +
testsuite/tests/ghci/scripts/T8931.script | 1 +
testsuite/tests/ghci/scripts/ghci044.script | 1 +
testsuite/tests/ghci/scripts/ghci044.stderr | 6 +-
testsuite/tests/ghci/scripts/ghci047.script | 1 +
testsuite/tests/ghci/scripts/ghci047.stderr | 4 +-
testsuite/tests/haddock/haddock_examples/Test.hs | 1 +
.../haddock/haddock_examples/haddock.Test.stderr | 8 +-
.../should_compile_flag_haddock/haddockA023.hs | 2 +
.../should_compile_flag_haddock/haddockA026.hs | 2 +
.../should_compile_flag_haddock/haddockA027.hs | 2 +
.../should_compile_noflag_haddock/haddockC026.hs | 2 +
.../should_compile_noflag_haddock/haddockC027.hs | 2 +
.../tests/indexed-types/should_compile/Class2.hs | 1 +
.../tests/indexed-types/should_compile/Gentle.hs | 1 +
.../should_compile/InstContextNorm.hs | 1 +
.../indexed-types/should_compile/InstEqContext.hs | 1 +
.../indexed-types/should_compile/InstEqContext2.hs | 1 +
.../indexed-types/should_compile/InstEqContext3.hs | 1 +
.../indexed-types/should_compile/NonLinearLHS.hs | 1 +
.../tests/indexed-types/should_compile/Rules1.hs | 1 +
.../tests/indexed-types/should_compile/Simple24.hs | 1 +
.../tests/indexed-types/should_compile/T2448.hs | 1 +
.../tests/indexed-types/should_compile/T3023.hs | 3 +-
.../indexed-types/should_compile/T3023.stderr | 5 +-
.../tests/indexed-types/should_compile/T3484.hs | 3 +-
.../tests/indexed-types/should_compile/T4200.hs | 1 +
.../tests/indexed-types/should_compile/T4497.hs | 1 +
.../tests/indexed-types/should_compile/T4981-V1.hs | 2 +
.../tests/indexed-types/should_compile/T4981-V2.hs | 2 +
.../tests/indexed-types/should_compile/T4981-V3.hs | 2 +
.../tests/indexed-types/should_compile/T5002.hs | 1 +
.../tests/indexed-types/should_compile/T9090.hs | 2 +
.../tests/indexed-types/should_compile/T9316.hs | 1 +
.../tests/indexed-types/should_compile/T9747.hs | 2 +
testsuite/tests/indexed-types/should_fail/T2239.hs | 1 +
.../tests/indexed-types/should_fail/T3330c.stderr | 4 +
testsuite/tests/indexed-types/should_fail/T7862.hs | 1 +
.../tests/indexed-types/should_fail/T7862.stderr | 2 +-
testsuite/tests/module/mod129.hs | 2 +
testsuite/tests/module/mod71.stderr | 9 +
testsuite/tests/parser/should_compile/mc15.hs | 2 +-
testsuite/tests/parser/should_compile/read002.hs | 2 +
testsuite/tests/partial-sigs/should_compile/all.T | 2 +-
testsuite/tests/patsyn/should_compile/T8584-2.hs | 2 +
testsuite/tests/patsyn/should_compile/T8968-1.hs | 1 +
testsuite/tests/patsyn/should_compile/all.T | 4 +-
testsuite/tests/patsyn/should_compile/ex-view.hs | 4 +-
testsuite/tests/perf/compiler/T3064.hs | 2 +
testsuite/tests/perf/compiler/T5030.hs | 6 +-
testsuite/tests/polykinds/PolyKinds08.hs | 1 +
testsuite/tests/polykinds/T6015a.hs | 1 +
testsuite/tests/polykinds/T6020a.hs | 1 +
testsuite/tests/polykinds/T6068.hs | 1 +
testsuite/tests/polykinds/T7090.hs | 1 +
testsuite/tests/polykinds/T7332.hs | 20 +-
testsuite/tests/polykinds/T8359.hs | 2 +
testsuite/tests/polykinds/T9569.hs | 1 +
testsuite/tests/polykinds/T9750.hs | 1 +
testsuite/tests/rebindable/T5821.hs | 3 +-
testsuite/tests/rebindable/rebindable9.hs | 4 +-
testsuite/tests/rename/should_fail/rnfail020.hs | 1 +
testsuite/tests/simplCore/should_compile/T3831.hs | 1 +
testsuite/tests/simplCore/should_compile/T4398.hs | 1 +
.../tests/simplCore/should_compile/T4398.stderr | 2 +-
testsuite/tests/simplCore/should_compile/T5329.hs | 1 +
testsuite/tests/simplCore/should_compile/T5342.hs | 1 +
testsuite/tests/simplCore/should_compile/T5359b.hs | 1 +
.../tests/simplCore/should_compile/T5359b.stderr | 2 +-
testsuite/tests/simplCore/should_compile/T8848.hs | 3 +-
.../tests/simplCore/should_compile/T8848.stderr | 2 +-
testsuite/tests/simplCore/should_compile/T8848a.hs | 1 +
.../tests/simplCore/should_compile/simpl002.hs | 2 +
.../tests/simplCore/should_compile/simpl007.hs | 1 +
.../tests/simplCore/should_compile/simpl014.hs | 1 +
.../tests/simplCore/should_compile/simpl016.hs | 2 +
.../tests/simplCore/should_compile/simpl016.stderr | 2 +-
.../tests/simplCore/should_compile/spec003.hs | 2 +
testsuite/tests/th/T3100.hs | 1 +
testsuite/tests/th/T7021a.hs | 1 +
testsuite/tests/th/T8807.hs | 1 +
testsuite/tests/th/TH_tf3.hs | 1 +
.../typecheck/should_compile/GivenOverlapping.hs | 1 +
.../typecheck/should_compile/LoopOfTheDay1.hs | 1 +
.../typecheck/should_compile/LoopOfTheDay2.hs | 1 +
.../typecheck/should_compile/LoopOfTheDay3.hs | 1 +
testsuite/tests/typecheck/should_compile/T1470.hs | 1 +
testsuite/tests/typecheck/should_compile/T2683.hs | 1 +
testsuite/tests/typecheck/should_compile/T3018.hs | 1 +
testsuite/tests/typecheck/should_compile/T3108.hs | 1 +
testsuite/tests/typecheck/should_compile/T3692.hs | 1 +
testsuite/tests/typecheck/should_compile/T3743.hs | 1 +
testsuite/tests/typecheck/should_compile/T4361.hs | 1 +
testsuite/tests/typecheck/should_compile/T4401.hs | 1 +
testsuite/tests/typecheck/should_compile/T4524.hs | 1 +
testsuite/tests/typecheck/should_compile/T4952.hs | 1 +
testsuite/tests/typecheck/should_compile/T4969.hs | 2 +-
testsuite/tests/typecheck/should_compile/T5514.hs | 1 +
testsuite/tests/typecheck/should_compile/T5581.hs | 2 +
testsuite/tests/typecheck/should_compile/T5676.hs | 1 +
testsuite/tests/typecheck/should_compile/T6055.hs | 1 +
testsuite/tests/typecheck/should_compile/T6134.hs | 1 +
testsuite/tests/typecheck/should_compile/T7171a.hs | 1 +
testsuite/tests/typecheck/should_compile/T7196.hs | 1 +
testsuite/tests/typecheck/should_compile/T7220.hs | 1 +
testsuite/tests/typecheck/should_compile/T7541.hs | 2 +-
testsuite/tests/typecheck/should_compile/T7875.hs | 1 +
testsuite/tests/typecheck/should_compile/T7903.hs | 1 +
.../typecheck/should_compile/T7903.stderr-ghc | 4 +-
.../tests/typecheck/should_compile/Tc170_Aux.hs | 1 +
testsuite/tests/typecheck/should_compile/Tc173a.hs | 2 +
testsuite/tests/typecheck/should_compile/tc045.hs | 1 +
testsuite/tests/typecheck/should_compile/tc051.hs | 2 +
.../tests/typecheck/should_compile/tc056.stderr | 6 +-
testsuite/tests/typecheck/should_compile/tc058.hs | 2 +
testsuite/tests/typecheck/should_compile/tc065.hs | 4 +-
testsuite/tests/typecheck/should_compile/tc078.hs | 2 +
.../typecheck/should_compile/tc078.stderr-ghc | 4 +-
testsuite/tests/typecheck/should_compile/tc079.hs | 2 +
testsuite/tests/typecheck/should_compile/tc088.hs | 2 +
testsuite/tests/typecheck/should_compile/tc091.hs | 2 +
testsuite/tests/typecheck/should_compile/tc092.hs | 1 +
testsuite/tests/typecheck/should_compile/tc109.hs | 1 +
testsuite/tests/typecheck/should_compile/tc113.hs | 2 +
testsuite/tests/typecheck/should_compile/tc115.hs | 1 +
.../typecheck/should_compile/tc115.stderr-ghc | 2 +-
testsuite/tests/typecheck/should_compile/tc116.hs | 1 +
.../typecheck/should_compile/tc116.stderr-ghc | 2 +-
testsuite/tests/typecheck/should_compile/tc125.hs | 1 +
.../typecheck/should_compile/tc125.stderr-ghc | 10 +-
testsuite/tests/typecheck/should_compile/tc126.hs | 1 +
.../typecheck/should_compile/tc126.stderr-ghc | 4 +-
testsuite/tests/typecheck/should_compile/tc145.hs | 1 +
testsuite/tests/typecheck/should_compile/tc152.hs | 1 +
testsuite/tests/typecheck/should_compile/tc176.hs | 1 +
testsuite/tests/typecheck/should_compile/tc178.hs | 1 +
testsuite/tests/typecheck/should_compile/tc180.hs | 1 +
testsuite/tests/typecheck/should_compile/tc181.hs | 1 +
testsuite/tests/typecheck/should_compile/tc183.hs | 1 +
testsuite/tests/typecheck/should_compile/tc187.hs | 1 +
testsuite/tests/typecheck/should_compile/tc192.hs | 1 +
testsuite/tests/typecheck/should_compile/tc203.hs | 1 +
testsuite/tests/typecheck/should_compile/tc204.hs | 3 +-
testsuite/tests/typecheck/should_compile/tc206.hs | 1 +
testsuite/tests/typecheck/should_compile/tc208.hs | 1 +
testsuite/tests/typecheck/should_compile/tc229.hs | 1 +
testsuite/tests/typecheck/should_compile/tc230.hs | 1 +
testsuite/tests/typecheck/should_compile/tc235.hs | 1 +
testsuite/tests/typecheck/should_compile/tc237.hs | 1 +
testsuite/tests/typecheck/should_compile/tc239.hs | 1 +
testsuite/tests/typecheck/should_compile/twins.hs | 1 +
testsuite/tests/typecheck/should_fail/T6161.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail017.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail020.stderr | 4 +-
testsuite/tests/typecheck/should_fail/tcfail071.hs | 2 +
testsuite/tests/typecheck/should_fail/tcfail138.hs | 1 +
.../tests/typecheck/should_fail/tcfail143.stderr | 4 +-
207 files changed, 1595 insertions(+), 855 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 32973bf3c2f6fe00e01b44a63ac1904080466938
More information about the ghc-commits
mailing list