Fix #13983 by creating a TyConFlavour type, and using it
authorRyan Scott <ryan.gl.scott@gmail.com>
Wed, 19 Jul 2017 19:07:01 +0000 (15:07 -0400)
committerBen Gamari <ben@smart-cactus.org>
Wed, 19 Jul 2017 22:02:49 +0000 (18:02 -0400)
commit6e3c901db7a624d030614113c51be5731d1ac862
tree95c95e9924222c933a6f23ec6e2eec860074d82f
parentc940e3b92f4527ca59fcae93f36c869de3e7ccb9
Fix #13983 by creating a TyConFlavour type, and using it

An error message was referring to a type synonym as a datatype.
Annoyingly, learning that the TyCon over which the error message is
operating is actually a type synonym was previously impossible, since
that code only had access to a TcTyCon, which doesn't retain any
information about what sort of TyCon it is.

To rectify this, I created a new TyConFlavour datatype, intended to
capture roughly what sort of TyCon we're dealing with. I then performing
the necessary plumbing to ensure all TcTyCons have a TyConFlavour, and
propagated this information through to the relevant error message.

Test Plan: ./validate

Reviewers: goldfire, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #13983

Differential Revision: https://phabricator.haskell.org/D3747
compiler/typecheck/TcHsType.hs
compiler/typecheck/TcPat.hs
compiler/typecheck/TcTyClsDecls.hs
compiler/typecheck/TcValidity.hs
compiler/types/TyCon.hs
testsuite/tests/ghci/scripts/T7873.stderr
testsuite/tests/typecheck/should_fail/T13983.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T13983.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T