[Git][ghc/ghc][wip/sand-witch/gadt-layout-refact] Refactor ConDeclGADT to allow nested foralls and contexts (27425)
Andrei Borzenkov pushed to branch wip/sand-witch/gadt-layout-refact at Glasgow Haskell Compiler / GHC Commits: 30f0d782 by Andrei Borzenkov at 2026-11-18T17:14:28+04:00 Refactor ConDeclGADT to allow nested foralls and contexts (27425) This patch refactors GADT prefix constructor layout, allowing interleaved `forall`s, contexts and value arguments. Main change: ```diff data ConDecl pass = ConDeclGADT { ... - , con_inner_bndrs :: [LHsGadtTelescope pass] - , con_cxts :: [LHsContext pass] , con_g_args :: HsConDeclGADTDetails pass ... } | .... ``` Telescopes and contexts were moved into `HsConDeclGADTDetails` and now represented by `HsGadtArg`: ```haskell data HsConDeclGADTDetails pass = PrefixConGADT !(XPrefixConGADT pass) [LHsGadtArg pass] -- new! | RecConGADT !(XRecConGADT pass) (Maybe (LHsContext pass)) -- new! (XRec pass [LHsConDeclRecField pass]) ``` RecConGADT constructor now has `Maybe LHsContext` field to enforce distinction between prefix constructors and record constructors. `HsGadtTelescope` was renamed into `HsGadtArg` because it can now represent contexts and value arguments in addition to previously supported parentheses and telescopes. List of compiler subsystems that assume old signature ordering: typechecking template-haskell (both ways) HIE generation check-exact several places in the haddock no-changelog - - - - - 43 changed files: - compiler/GHC/Hs/Decls.hs - compiler/GHC/Hs/Instances.hs - compiler/GHC/Hs/Type.hs - compiler/GHC/Hs/Utils.hs - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/HsToCore/Errors/Ppr.hs - compiler/GHC/HsToCore/Errors/Types.hs - compiler/GHC/HsToCore/Quote.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Parser/PostProcess/Haddock.hs - compiler/GHC/Rename/HsType.hs - compiler/GHC/Rename/Module.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/TyCl.hs - compiler/GHC/ThToHs.hs - compiler/Language/Haskell/Syntax/Decls.hs - compiler/Language/Haskell/Syntax/Type.hs - testsuite/tests/gadt/T12087b.stderr - testsuite/tests/gadt/T16427.stderr - testsuite/tests/gadt/T27423b.stderr - testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr - testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr - testsuite/tests/parser/should_compile/DumpParsedAst.stderr - testsuite/tests/parser/should_compile/DumpRenamedAst.stderr - testsuite/tests/parser/should_compile/T15323.stderr - testsuite/tests/printer/T18791.stderr - + testsuite/tests/th/GadtConSigs_th_contextAfterValue.hs - + testsuite/tests/th/GadtConSigs_th_contextAfterValue.stderr - + testsuite/tests/th/GadtConSigs_th_forallAfterContext.hs - + testsuite/tests/th/GadtConSigs_th_forallAfterContext.stderr - + testsuite/tests/th/GadtConSigs_th_forallAfterValue.hs - + testsuite/tests/th/GadtConSigs_th_forallAfterValue.stderr - testsuite/tests/th/all.T - utils/check-exact/ExactPrint.hs - utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs - utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs - utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs - utils/haddock/haddock-api/src/Haddock/Convert.hs - utils/haddock/haddock-api/src/Haddock/GhcUtils.hs - utils/haddock/haddock-api/src/Haddock/Interface/Create.hs - utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs - utils/haddock/haddock-api/src/Haddock/Types.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/30f0d7824103677406fcafe2edeed789... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/30f0d7824103677406fcafe2edeed789... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Andrei Borzenkov (@sand-witch)