Improve pretty-printing of types
authorSimon Peyton Jones <simonpj@microsoft.com>
Wed, 1 Mar 2017 01:20:21 +0000 (20:20 -0500)
committerDavid Feuer <David.Feuer@gmail.com>
Wed, 1 Mar 2017 01:20:22 +0000 (20:20 -0500)
commit871b63e4ea95d4c516d31378d0475167e75caa01
tree9291801818863be4269fdc5cb3a313645b13dd8c
parentcdf6b69563f66b3ef26481003654d645466e5450
Improve pretty-printing of types

When doing debug-printing it's really important that the free vars
of a type are printed with their uniques.  The IfaceTcTyVar thing
was a stab in that direction, but it only worked for TcTyVars, not
TyVars.

This patch does it properly, by keeping track of the free vars of the
type when translating Type -> IfaceType, and passing that down through
toIfaceTypeX.  Then when we find a variable, look in that set, and
translate it to IfaceFreeTyVar if so.  (I renamed IfaceTcTyVar to
IfaceFreeTyVar.)

Fiddly but not difficult.

Reviewers: austin, goldfire, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D3201
13 files changed:
compiler/backpack/RnModIface.hs
compiler/iface/IfaceSyn.hs
compiler/iface/IfaceType.hs
compiler/iface/TcIface.hs
compiler/iface/ToIface.hs
compiler/iface/ToIface.hs-boot
compiler/typecheck/TcRnTypes.hs
compiler/types/TyCoRep.hs
compiler/types/Type.hs
compiler/types/Type.hs-boot
testsuite/tests/deriving/should_fail/T7148.stderr
testsuite/tests/th/T8761.stderr
testsuite/tests/typecheck/should_fail/T12785b.stderr