Add "quantified constraint" context in error message, fix #15231.
authorHE, Tao <sighingnow@gmail.com>
Fri, 15 Jun 2018 17:45:42 +0000 (13:45 -0400)
committerBen Gamari <ben@smart-cactus.org>
Fri, 15 Jun 2018 17:47:42 +0000 (13:47 -0400)
commit91822e4eee295a42f69489c7e9e878b296e897bc
treef601b1c1f052da905ea7ff3134a8f32a409a3ffe
parentb67b971740e77ba5e9e2892ac0f668d41c38381f
Add "quantified constraint" context in error message, fix #15231.

This patch adds "quantified constraint" context in error message when
UndecidableInstances checking fails for quantified constraints.
See Trac #15231:comment#1.

This patch also pretty-prints the instance head for better error messages.

Test Plan: make test TEST="T15231"

Reviewers: bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #15231

Differential Revision: https://phabricator.haskell.org/D4819
12 files changed:
compiler/typecheck/TcValidity.hs
testsuite/tests/deriving/should_fail/T8165_fail2.stderr
testsuite/tests/indexed-types/should_fail/NotRelaxedExamples.stderr
testsuite/tests/indexed-types/should_fail/T10817.stderr
testsuite/tests/indexed-types/should_fail/TyFamUndec.stderr
testsuite/tests/quantified-constraints/T15231.hs [new file with mode: 0644]
testsuite/tests/quantified-constraints/T15231.stderr [new file with mode: 0644]
testsuite/tests/quantified-constraints/all.T
testsuite/tests/typecheck/should_fail/fd-loop.stderr
testsuite/tests/typecheck/should_fail/tcfail108.stderr
testsuite/tests/typecheck/should_fail/tcfail154.stderr
testsuite/tests/typecheck/should_fail/tcfail157.stderr