[commit: ghc] master: Rearrange error msgs and add section markers (Trac #11014). (c05fddd)
git at git.haskell.org
git at git.haskell.org
Tue Nov 24 13:02:56 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/c05fdddec71f9dc8ebe62d751ccf03367128072a/ghc
>---------------------------------------------------------------
commit c05fdddec71f9dc8ebe62d751ccf03367128072a
Author: Evan Laforge <qdunkan at gmail.com>
Date: Tue Nov 24 12:43:18 2015 +0100
Rearrange error msgs and add section markers (Trac #11014).
This puts the "Relevant bindings" section at the end.
It uses a TcErrors.Report Monoid to divide messages by importance and
then mappends them together. This is not the most efficient way since
there are various intermediate Reports and list appends, but it probably
doesn't matter since error messages shouldn't get that large, and are
usually prepended. In practice, everything is `important` except
`relevantBindings`, which is `supplementary`.
ErrMsg's errMsgShortDoc and errMsgExtraInfo were extracted into ErrDoc,
which has important, context, and suppelementary fields. Each of those
three sections is marked with a bullet character, '•' on unicode
terminals and '*' on ascii terminals. Since this breaks tons of tests,
I also modified testlib.normalise_errmsg to strip out '•'s.
--- Additional notes:
To avoid prepending * to an empty doc, I needed to filter empty docs.
This seemed less error-prone than trying to modify everyone who produces
SDoc to instead produce Maybe SDoc. So I added `Outputable.isEmpty`.
Unfortunately it needs a DynFlags, which is kind of bogus, but otherwise
I think I'd need another Empty case for SDoc, and then it couldn't be a
newtype any more.
ErrMsg's errMsgShortString is only used by the Show instance, which is
in turn only used by Show HscTypes.SourceError, which is in turn only
needed for the Exception instance. So it's probably possible to get rid
of errMsgShortString, but that would a be an unrelated cleanup.
Fixes #11014.
Test Plan: see above
Reviewers: austin, simonpj, thomie, bgamari
Reviewed By: thomie, bgamari
Subscribers: simonpj, nomeata, thomie
Differential Revision: https://phabricator.haskell.org/D1427
GHC Trac Issues: #11014
>---------------------------------------------------------------
c05fdddec71f9dc8ebe62d751ccf03367128072a
compiler/cmm/CmmLayoutStack.hs | 2 +-
compiler/main/ErrUtils.hs | 80 ++++++----
compiler/typecheck/TcErrors.hs | 166 ++++++++++++++-------
compiler/typecheck/TcRnMonad.hs | 10 +-
compiler/utils/Outputable.hs | 8 +-
testsuite/driver/testlib.py | 12 +-
testsuite/tests/arrows/should_fail/T5380.stderr | 8 +-
testsuite/tests/driver/T2507.stderr | 6 +-
testsuite/tests/driver/T6037.stderr | 6 +-
testsuite/tests/driver/T8959a.stderr | 6 +-
testsuite/tests/gadt/T3169.stderr | 4 +-
testsuite/tests/gadt/T7558.stderr | 4 +-
testsuite/tests/gadt/gadt-escape1.stderr | 4 +-
testsuite/tests/gadt/gadt13.stderr | 4 +-
testsuite/tests/gadt/gadt7.stderr | 4 +-
testsuite/tests/gadt/rw.stderr | 10 +-
testsuite/tests/ghci/scripts/Defer02.stderr | 24 +--
testsuite/tests/ghci/scripts/ghci050.stderr | 4 +-
.../should_compile/PushedInAsGivens.stderr | 10 +-
.../indexed-types/should_compile/T3208b.stderr | 6 +-
.../indexed-types/should_fail/ExtraTcsUntch.stderr | 12 +-
.../indexed-types/should_fail/GADTwrong1.stderr | 4 +-
.../indexed-types/should_fail/Overlap10.stderr | 4 +-
.../indexed-types/should_fail/Overlap11.stderr | 4 +-
.../indexed-types/should_fail/Overlap15.stderr | 4 +-
.../indexed-types/should_fail/Overlap6.stderr | 4 +-
.../indexed-types/should_fail/Overlap9.stderr | 4 +-
.../indexed-types/should_fail/SimpleFail16.stderr | 4 +-
.../indexed-types/should_fail/SimpleFail5a.stderr | 4 +-
.../tests/indexed-types/should_fail/T2544.stderr | 8 +-
.../tests/indexed-types/should_fail/T2664.stderr | 6 +-
.../tests/indexed-types/should_fail/T2693.stderr | 4 +-
.../tests/indexed-types/should_fail/T3330a.stderr | 12 +-
.../tests/indexed-types/should_fail/T3330c.stderr | 4 +-
.../tests/indexed-types/should_fail/T3440.stderr | 4 +-
.../tests/indexed-types/should_fail/T4093a.stderr | 2 +-
.../tests/indexed-types/should_fail/T4093b.stderr | 18 +--
.../tests/indexed-types/should_fail/T4099.stderr | 8 +-
.../tests/indexed-types/should_fail/T4174.stderr | 8 +-
.../tests/indexed-types/should_fail/T4179.stderr | 4 +-
.../tests/indexed-types/should_fail/T4272.stderr | 6 +-
.../tests/indexed-types/should_fail/T5439.stderr | 4 +-
.../tests/indexed-types/should_fail/T6123.stderr | 2 +-
.../tests/indexed-types/should_fail/T7194.stderr | 4 +-
.../tests/indexed-types/should_fail/T7354.stderr | 4 +-
.../tests/indexed-types/should_fail/T7354a.stderr | 2 +-
.../tests/indexed-types/should_fail/T7729.stderr | 4 +-
.../tests/indexed-types/should_fail/T7729a.stderr | 4 +-
.../tests/indexed-types/should_fail/T7786.stderr | 18 +--
.../tests/indexed-types/should_fail/T8129.stdout | 2 +-
.../tests/indexed-types/should_fail/T8227.stderr | 10 +-
.../tests/indexed-types/should_fail/T8518.stderr | 16 +-
.../tests/indexed-types/should_fail/T9662.stderr | 24 +--
testsuite/tests/module/mod71.stderr | 6 +-
testsuite/tests/parser/should_fail/T7848.stderr | 26 ++--
.../tests/parser/should_fail/readFail003.stderr | 8 +-
.../partial-sigs/should_compile/SplicesUsed.stderr | 8 +-
.../partial-sigs/should_compile/T10438.stderr | 10 +-
.../partial-sigs/should_compile/T10463.stderr | 4 +-
.../partial-sigs/should_compile/TypedSplice.stderr | 8 +-
.../should_fail/NamedWildcardsNotEnabled.stderr | 8 +-
.../tests/partial-sigs/should_fail/T10045.stderr | 6 +-
.../tests/partial-sigs/should_fail/T10615.stderr | 4 +-
.../partial-sigs/should_fail/Trac10045.stderr | 6 +-
.../WildcardsInPatternAndExprSig.stderr | 36 ++---
testsuite/tests/polykinds/T7230.stderr | 6 +-
testsuite/tests/polykinds/T7438.stderr | 4 +-
testsuite/tests/polykinds/T7594.stderr | 2 +-
.../tests/simplCore/should_compile/simpl017.stderr | 20 +--
testsuite/tests/th/T10267.stderr | 12 +-
testsuite/tests/th/T7276a.stdout | 28 ++--
.../tests/typecheck/should_compile/FD1.stderr | 2 +-
.../tests/typecheck/should_compile/FD2.stderr | 4 +-
.../tests/typecheck/should_compile/FD3.stderr | 4 +-
.../tests/typecheck/should_compile/T2494.stderr | 8 +-
.../tests/typecheck/should_compile/T9497a.stderr | 2 +-
.../tests/typecheck/should_compile/T9834.stderr | 12 +-
.../tests/typecheck/should_compile/holes.stderr | 14 +-
.../tests/typecheck/should_compile/holes2.stderr | 2 +-
.../tests/typecheck/should_compile/holes3.stderr | 14 +-
.../tests/typecheck/should_compile/tc141.stderr | 8 +-
.../typecheck/should_fail/FDsFromGivens2.stderr | 4 +-
.../typecheck/should_fail/FrozenErrorTests.stderr | 12 +-
.../tests/typecheck/should_fail/T10285.stderr | 4 +-
.../tests/typecheck/should_fail/T10495.stderr | 2 +-
.../tests/typecheck/should_fail/T10534.stderr | 4 +-
.../tests/typecheck/should_fail/T10715b.stderr | 2 +-
testsuite/tests/typecheck/should_fail/T1899.stderr | 4 +-
testsuite/tests/typecheck/should_fail/T2534.stderr | 2 +-
testsuite/tests/typecheck/should_fail/T2688.stderr | 4 +-
testsuite/tests/typecheck/should_fail/T2714.stderr | 8 +-
testsuite/tests/typecheck/should_fail/T3950.stderr | 4 +-
testsuite/tests/typecheck/should_fail/T5689.stderr | 4 +-
testsuite/tests/typecheck/should_fail/T5853.stderr | 4 +-
testsuite/tests/typecheck/should_fail/T7264.stderr | 4 +-
.../tests/typecheck/should_fail/T7368a.stderr | 4 +-
testsuite/tests/typecheck/should_fail/T7453.stderr | 18 +--
testsuite/tests/typecheck/should_fail/T7696.stderr | 2 +-
testsuite/tests/typecheck/should_fail/T7734.stderr | 8 +-
.../tests/typecheck/should_fail/T7748a.stderr | 10 +-
testsuite/tests/typecheck/should_fail/T7869.stderr | 8 +-
testsuite/tests/typecheck/should_fail/T8044.stderr | 4 +-
testsuite/tests/typecheck/should_fail/T8142.stderr | 4 +-
testsuite/tests/typecheck/should_fail/T8262.stderr | 4 +-
testsuite/tests/typecheck/should_fail/T8428.stderr | 4 +-
testsuite/tests/typecheck/should_fail/T8450.stderr | 2 +-
testsuite/tests/typecheck/should_fail/T9109.stderr | 2 +-
.../tests/typecheck/should_fail/T9497d.stderr | 2 +-
testsuite/tests/typecheck/should_fail/T9605.stderr | 2 +-
testsuite/tests/typecheck/should_fail/T9612.stderr | 10 +-
.../typecheck/should_fail/TcCoercibleFail.stderr | 4 +-
testsuite/tests/typecheck/should_fail/mc22.stderr | 2 +-
testsuite/tests/typecheck/should_fail/mc23.stderr | 2 +-
testsuite/tests/typecheck/should_fail/mc24.stderr | 2 +-
testsuite/tests/typecheck/should_fail/mc25.stderr | 2 +-
.../tests/typecheck/should_fail/tcfail001.stderr | 2 +-
.../tests/typecheck/should_fail/tcfail002.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail004.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail005.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail013.stderr | 2 +-
.../tests/typecheck/should_fail/tcfail014.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail016.stderr | 8 +-
.../tests/typecheck/should_fail/tcfail032.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail033.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail065.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail068.stderr | 18 +--
.../tests/typecheck/should_fail/tcfail076.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail099.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail103.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail122.stderr | 2 +-
.../tests/typecheck/should_fail/tcfail131.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail140.stderr | 12 +-
.../tests/typecheck/should_fail/tcfail153.stderr | 6 +-
.../tests/typecheck/should_fail/tcfail174.stderr | 8 +-
.../tests/typecheck/should_fail/tcfail175.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail178.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail179.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail182.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail198.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail200.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail201.stderr | 4 +-
.../tests/typecheck/should_fail/tcfail206.stderr | 8 +-
testsuite/tests/typecheck/should_run/T10284.stdout | 6 +-
testsuite/tests/typecheck/should_run/T7861.stderr | 4 +-
.../tests/typecheck/should_run/T9497a-run.stderr | 4 +-
.../tests/typecheck/should_run/T9497b-run.stderr | 4 +-
.../tests/typecheck/should_run/T9497c-run.stderr | 4 +-
.../tests/typecheck/should_run/tcrun035.stderr | 4 +-
148 files changed, 647 insertions(+), 547 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 c05fdddec71f9dc8ebe62d751ccf03367128072a
More information about the ghc-commits
mailing list