diff options
author | Evan Laforge <qdunkan@gmail.com> | 2015-11-24 12:43:18 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-11-24 14:02:58 +0100 |
commit | c05fdddec71f9dc8ebe62d751ccf03367128072a (patch) | |
tree | 4afadb128af4af0f99dfb92fdbb9607bbeb64f04 /testsuite/tests/th/T10267.stderr | |
parent | f09f2470a76bb08b7f51d2f5663daa672b86f618 (diff) | |
download | haskell-c05fdddec71f9dc8ebe62d751ccf03367128072a.tar.gz |
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
Diffstat (limited to 'testsuite/tests/th/T10267.stderr')
-rw-r--r-- | testsuite/tests/th/T10267.stderr | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/testsuite/tests/th/T10267.stderr b/testsuite/tests/th/T10267.stderr index 442a779e44..909479389d 100644 --- a/testsuite/tests/th/T10267.stderr +++ b/testsuite/tests/th/T10267.stderr @@ -5,11 +5,11 @@ T10267.hs:8:1: error: the type signature for: j :: a0 -> a0 at T10267.hs:8:1 + In the expression: _ + In an equation for ‘j’: j x = _ Relevant bindings include x :: a0 (bound at T10267.hs:8:1) j :: a0 -> a0 (bound at T10267.hs:8:1) - In the expression: _ - In an equation for ‘j’: j x = _ T10267.hs:8:1: error: Found hole: _foo :: a0 -> a0 @@ -18,9 +18,9 @@ T10267.hs:8:1: error: i :: a0 -> a0 at T10267.hs:8:1 Or perhaps ‘_foo’ is mis-spelled, or not in scope - Relevant bindings include i :: a0 -> a0 (bound at T10267.hs:8:1) In the expression: _foo In an equation for ‘i’: i = _foo + Relevant bindings include i :: a0 -> a0 (bound at T10267.hs:8:1) T10267.hs:14:3: error: Found hole: _foo :: a -> a @@ -29,9 +29,9 @@ T10267.hs:14:3: error: k :: a -> a at T10267.hs:14:3 Or perhaps ‘_foo’ is mis-spelled, or not in scope - Relevant bindings include k :: a -> a (bound at T10267.hs:14:3) In the expression: _foo In an equation for ‘k’: k = _foo + Relevant bindings include k :: a -> a (bound at T10267.hs:14:3) T10267.hs:23:3: error: Found hole: _ :: a @@ -39,8 +39,8 @@ T10267.hs:23:3: error: the type signature for: l :: a -> a at T10267.hs:23:3 + In the expression: _ + In an equation for ‘l’: l x = _ Relevant bindings include x :: a (bound at T10267.hs:23:3) l :: a -> a (bound at T10267.hs:23:3) - In the expression: _ - In an equation for ‘l’: l x = _ |