Improve error messages for skolems
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 10 Mar 2017 11:46:50 +0000 (11:46 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 10 Mar 2017 16:05:21 +0000 (16:05 +0000)
commit48d1866e9051e52b80c9c88547bd66d66483f1d5
tree72047939e1bad05062f7518db97b6c999d32c948
parent7e96526ac2ef5987ecb03217d3d616b6281c1441
Improve error messages for skolems

In error messages like this
    • Couldn't match type ‘c’ with ‘f0 (a -> b)’
      ‘c’ is a rigid type variable bound by
        the type signature for:
          f :: ((a -> b) -> b) -> forall c. c -> a

we need to take case both to actually show that 'forall c',
and to make sure that its name lines with the 'c' in the
error message.

This has been shaky for some time, and this commit puts it on solid
ground.  See TcRnTypes: Note [SigSkol SkolemInfo]

The main changes are

* SigSkol gets an extra field that records the way in which the
  type signature was skolemised.

* The type in SigSkol is now the /un/-skolemised version

* pprSkolemInfo uses the info to make the tidy type line up
  nicely

Lots of error message wibbles!
61 files changed:
compiler/typecheck/Inst.hs
compiler/typecheck/TcBinds.hs
compiler/typecheck/TcErrors.hs
compiler/typecheck/TcExpr.hs
compiler/typecheck/TcMType.hs
compiler/typecheck/TcRnDriver.hs
compiler/typecheck/TcRnTypes.hs
compiler/typecheck/TcSimplify.hs
compiler/typecheck/TcUnify.hs
compiler/types/TyCoRep.hs
testsuite/tests/ado/ado005.stderr
testsuite/tests/backpack/should_fail/bkpfail24.stderr
testsuite/tests/backpack/should_fail/bkpfail44.stderr
testsuite/tests/deriving/should_fail/T5287.stderr
testsuite/tests/indexed-types/should_compile/PushedInAsGivens.stderr
testsuite/tests/indexed-types/should_compile/T3208b.stderr
testsuite/tests/indexed-types/should_fail/T2664.stderr
testsuite/tests/indexed-types/should_fail/T4093a.stderr
testsuite/tests/indexed-types/should_fail/T4093b.stderr
testsuite/tests/indexed-types/should_fail/T7194.stderr
testsuite/tests/monadfail/MonadFailErrors.stderr
testsuite/tests/monadfail/MonadFailWarnings.stderr
testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr
testsuite/tests/parser/should_fail/T7848.stderr
testsuite/tests/partial-sigs/should_compile/T10403.stderr
testsuite/tests/polykinds/T7230.stderr
testsuite/tests/polykinds/T7594.stderr
testsuite/tests/typecheck/should_compile/T7220a.stderr
testsuite/tests/typecheck/should_compile/T9834.stderr
testsuite/tests/typecheck/should_compile/T9939.stderr
testsuite/tests/typecheck/should_compile/tc168.stderr
testsuite/tests/typecheck/should_fail/ClassOperator.stderr
testsuite/tests/typecheck/should_fail/T10534.stderr
testsuite/tests/typecheck/should_fail/T11947a.stderr
testsuite/tests/typecheck/should_fail/T11948.stderr
testsuite/tests/typecheck/should_fail/T12151.stderr
testsuite/tests/typecheck/should_fail/T12918b.stderr
testsuite/tests/typecheck/should_fail/T1897a.stderr
testsuite/tests/typecheck/should_fail/T2714.stderr
testsuite/tests/typecheck/should_fail/T3592.stderr
testsuite/tests/typecheck/should_fail/T5300.stderr
testsuite/tests/typecheck/should_fail/T7279.stderr
testsuite/tests/typecheck/should_fail/T7437.stderr
testsuite/tests/typecheck/should_fail/T7453.stderr
testsuite/tests/typecheck/should_fail/T7869.stderr
testsuite/tests/typecheck/should_fail/tcfail032.stderr
testsuite/tests/typecheck/should_fail/tcfail034.stderr
testsuite/tests/typecheck/should_fail/tcfail067.stderr
testsuite/tests/typecheck/should_fail/tcfail072.stderr
testsuite/tests/typecheck/should_fail/tcfail080.stderr
testsuite/tests/typecheck/should_fail/tcfail097.stderr
testsuite/tests/typecheck/should_fail/tcfail098.stderr
testsuite/tests/typecheck/should_fail/tcfail102.stderr
testsuite/tests/typecheck/should_fail/tcfail116.stderr
testsuite/tests/typecheck/should_fail/tcfail125.stderr
testsuite/tests/typecheck/should_fail/tcfail142.stderr
testsuite/tests/typecheck/should_fail/tcfail171.stderr
testsuite/tests/typecheck/should_fail/tcfail198.stderr
testsuite/tests/typecheck/should_fail/tcfail208.stderr
testsuite/tests/warnings/should_compile/PluralS.stderr
testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr