Refactor ConDecl: Trac #14529
authorSimon Peyton Jones <simonpj@microsoft.com>
Tue, 28 Nov 2017 11:33:37 +0000 (11:33 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Thu, 7 Dec 2017 14:40:35 +0000 (14:40 +0000)
commitfa29df02a1b0b926afb2525a258172dcbf0ea460
tree594244e6f84a99a36acfd962eeb62b4a35f42726
parent5f332e1dab000e1f79c127d441f618280d14d2bd
Refactor ConDecl: Trac #14529

This patch refactors HsDecls.ConDecl.  Specifically

* ConDeclGADT was horrible, with all the information hidden
  inside con_res_ty.  Now it's kept separate, as it should be.

* ConDeclH98: use [LHsTyVarBndr] instead of LHsQTyVars for the
  existentials. There is no implicit binding here.

* Add a field con_forall to both ConDeclGADT and ConDeclH98
  which says if there is an explicit user-written forall.

* Field renamings in ConDecl
     con_cxt     to con_mb_cxt
     con_details to con_args

There is an accompanying submodule update to Haddock.

Also the following change turned out to remove a lot of clutter:

* add a smart constructor for HsAppsTy, namely mkHsAppsTy,
  and use it consistently. This avoids a lot of painful pattern
  matching for the common singleton case.

Two api-annotation tests (T10278, and T10399) are broken, hence marking
them as expect_broken(14529).  Alan is going to fix them, probably by
changing the con_forall field to
   con_forall :: Maybe SrcSpan
instead of Bool
24 files changed:
compiler/deSugar/DsMeta.hs
compiler/hsSyn/Convert.hs
compiler/hsSyn/HsDecls.hs
compiler/hsSyn/HsTypes.hs
compiler/hsSyn/HsUtils.hs
compiler/parser/Parser.y
compiler/parser/RdrHsSyn.hs
compiler/rename/RnNames.hs
compiler/rename/RnSource.hs
compiler/rename/RnTypes.hs
compiler/typecheck/TcHsType.hs
compiler/typecheck/TcTyClsDecls.hs
compiler/utils/ListSetOps.hs
testsuite/tests/ghc-api/annotations/all.T
testsuite/tests/parser/should_compile/DumpParsedAst.stderr
testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
testsuite/tests/parser/should_compile/T14189.stderr
testsuite/tests/patsyn/should_fail/T11039.stderr
testsuite/tests/patsyn/should_fail/T11667.stderr
testsuite/tests/rename/should_compile/T5331.stderr
testsuite/tests/th/T13123.hs
testsuite/tests/typecheck/should_compile/T2494.stderr
utils/haddock
utils/hsc2hs