Add a pattern-syn form of PromotionErr
authorSimon Peyton Jones <simonpj@microsoft.com>
Mon, 21 Dec 2015 14:18:32 +0000 (14:18 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Wed, 23 Dec 2015 07:46:37 +0000 (07:46 +0000)
commitc069be815aa0bce2eb2c9621a36f114badda2318
treec2ca0da9aa43f40ca2787877870263adc989cadb
parent19632501654cac9d84088c69bd4291009292c5c3
Add a pattern-syn form of PromotionErr

The main change is to add PatSynPE to PromotionErr, so that
when we get an ill-staged use of a pattern synonym we get a
civilised error message.

We were already doing this in half-baked form in tcValBinds, but
this patch tidies up the impl (which previously used a hack rather
than APromotionErr), and does it in tcTyClsInstDecls too.
compiler/hsSyn/HsBinds.hs
compiler/typecheck/TcBinds.hs
compiler/typecheck/TcEnv.hs
compiler/typecheck/TcHsType.hs
compiler/typecheck/TcRnDriver.hs
compiler/typecheck/TcRnTypes.hs
testsuite/tests/patsyn/should_fail/T11265.hs [new file with mode: 0644]
testsuite/tests/patsyn/should_fail/T11265.stderr [new file with mode: 0644]
testsuite/tests/patsyn/should_fail/T9161-1.stderr
testsuite/tests/patsyn/should_fail/T9161-2.stderr
testsuite/tests/patsyn/should_fail/all.T