Skip to content

Draft: Introduce and use ConGadtSigBody (preparatory refactor for #18389)

Ryan Scott requested to merge wip/T18389-task-zero into master

This patch removes the con_g_args :: HsConDeclGADTDetails pass and con_res_ty :: LHsType pass fields of ConDeclGADT in favor of a unified con_body :: ConGadtSigBody pass field. There are two major differences between HsConDeclGADTDetails and ConGadtSigBody:

  1. HsConDeclGADTDetails only contains the argument type, while ConGadtSigBody contains both the argument and result types.
  2. The PrefixConGADT constructor of ConGadtSigBody now uses a new PrefixConGadtSigBody data type. PrefixConGadtSigBody closely mirrors the structure of HsType, but with minor, data constructor–specific tweaks. This will become vital in a future patch which implements nested foralls and contexts in prefix GADT constructor types (see #18389).

Besides the refactoring in the GHC API (and some minor changes in GHC AST–related test cases) this does not introduce any user-visible changes in behavior.

Edited by Andreas Klebinger

Merge request reports