[Git][ghc/ghc][wip/az/exactprint-annotation-rationalisation] 59 commits: Correct the documentation of `explicitUnits`
Alan Zimmerman pushed to branch wip/az/exactprint-annotation-rationalisation at Glasgow Haskell Compiler / GHC Commits: 53eead15 by Wolfgang Jeltsch at 2026-09-24T20:12:03-04:00 Correct the documentation of `explicitUnits` Resolves #27787. - - - - - 35bf6f4b by Simon Jakobi at 2026-09-24T20:12:49-04:00 Remove stale specHeader bullet from Note [Don't make fillers for constraint types] The Note said that Specialise.specHeader also calls mkAbsentFiller. abfc224a27c removed that call: the specialiser no longer drops dead arguments at all, see Note [Do not drop dead args from specialisations] in GHC.Core.Opt.Specialise. Assisted-by: Claude Fable 5.1 - - - - - 1abef1ef by Wolfgang Jeltsch at 2026-09-25T17:02:07-04:00 Improve the `mhu-closure` makefile - - - - - a79a68ea by Wolfgang Jeltsch at 2026-09-25T17:02:07-04:00 Make `ghci-multi` hide all unneeded packages - - - - - d6e72450 by Wolfgang Jeltsch at 2026-09-25T17:02:07-04:00 Improve the definition of the home unit closure property - - - - - c9a2766d by Wolfgang Jeltsch at 2026-09-25T17:02:07-04:00 Re-implement the home unit closure check Compared to the previous implementation, the new one has the following advantages: * It is correct. - It distinguishes between units that have the same unit ID but different ABI hashes. - When `-hide-all-packages` is not used, it considers as home unit dependencies also units that are made implicitly available because they are in the package database. * It seems to be faster in usual settings. - In particular, it does not have a preparation phase in which it merges the dependency information from all home units, so that its running time does not grow linearly with the size of the package database in normal Cabal scenarios. * It is (hopefully) clearer. * It is better documented. - - - - - fa96acf8 by Wolfgang Jeltsch at 2026-09-25T17:02:07-04:00 Remove erroneous GHC flag in `hadrian-multi` The flag was `-Werror=-Wno-error=incomplete-record-selectors`. Its purpose was to permit incomplete record selectors, but because of the illegal combination of `-Werror=` and `-Wno-error` it was ignored, without any negative consequences. - - - - - 9f48a5b9 by Alan Zimmerman at 2026-09-25T17:02:50-04:00 EPA: Add specific layout field to AnnList Up to now AnnList has effectively served to represent lists of things having layout, regardless of whether they do or not. In Haskell, layout is optional in many places, as there is also an alternative syntax using braces and semi-colons, which is free-form. This commit introduces AnnListLayout, a data structure capturing this distinction. It is deliberately set up similarly to EpLayout, so that these two can be merged in time. The transition is done mechanically, where AnnListBraces is not used yet, the original Nothing case maps to AnnListNoLayout, and the Just case to AnnListLayout. Later commits will fine tune these against the actual parser layout. - - - - - 81e219fd by Alan Zimmerman at 2026-09-27T09:57:12+01:00 EPA: Use EpaLocation in EpVirtualBraces Haddock processing uses EpLayout.EpVirtualBraces to record the current layout column, for allocating haddock comments correctly. For exact printing, we need the line as well as the col, so we know how many lines to skip when the indented code block starts. This commit updates EpLayout.EpVirtualBraces so that it carries an EpaLocation instead of just the Int column, to allow it to be used for both purposes. It is a simple mechanical change, with no other impact, but it allows us to use EpLayout instead of AnnListLayout in AnnList, in the next commit in this series. - - - - - 89ff21da by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Use vocurly as basis for AnnListLayout For the existing cases that populate AnnList. This also shows up AnnList usages that can never capture layout. - - - - - 6bc967fa by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: AnnList clean up patch for empty where clause - - - - - d091def3 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Add TTG fields to FamilyInfo This commit is a simple add, with unused extension fields. It lays the groundwork for using them for exact print annotations - - - - - b4437661 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 WIP annclassdecl - - - - - ee3e8896 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Update AnnClsInstDecl to contain AnnList It was already separately tracking the '{', '}' and leading ';' values. This aligns it with layout-introducing parser productions ('vocurly'), so the layout processing can be handled uniformly - - - - - 9312f068 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Tidy up markAnnListA' It takes an action which can modify the AnnList, but this is never used. So remove it. - - - - - 97f2bb65 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Use AnnList for GADT declarations - - - - - bf81506e by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Use AnnList in AnnClassDecl - - - - - f930eea8 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 MOVE EPA: Plan for Fixing AnnList Layout Properly - - - - - af4534ac by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Make local binds located Use LHsLocalBinds instead of HsLocalBinds This reverses an earlier change, and brings processing of local binds into alignement with the exact printing principle that the LocatedA contents provide the location and extent of the enclosed item, together with any comments or context-specific trailing items like commas or semi colons. The internal TTG extension points only carry exact print annotations related to printing the item within its bounds. This change brings back the problem of EmptyLocalBinds, which by definition cannot have a location. These get a noSrcSpan location, which is ignored in the exact printing process. - - - - - 5bc8abf7 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Use AnnList in HsMultiIf It introduces layout, capture it - - - - - 701dbb38 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Use AnnList in DecBrl - - - - - b21856e1 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Replace AnnListLayout / AnnListBrackets with EpLayout - - - - - 3d1b5cee by Alan Zimmerman at 2026-09-27T10:11:11+01:00 WIP: setLayoutBoth inside markAnnListA Current problem is it is a global one-shot, and MG has one too Check: is it needed? if so, honouring EpLayout may be needed - - - - - 517d9c62 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA some tests for layout. WIP - - - - - 250e388f by Alan Zimmerman at 2026-09-27T10:11:11+01:00 MOVE: Exactprint layout scope plan. Do not commit - - - - - a8bda73c by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: tidy up a bit. Combine somewhere else - - - - - b0623353 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Introduce LayoutFrame stacks in ExactPrint state - - - - - 0d74271f by Alan Zimmerman at 2026-09-27T10:11:11+01:00 Align with ghc-exactprint - - - - - 4c71a47a by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Fix AnnList leading semis when layout When there is layout, anything printed triggers it, including leading semis. Add some test case examples too - - - - - f3198746 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 Exactprint: tidy up layout capturing - - - - - b01f993d by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: add makeDelta test for Test20297 The original #20297 related to comment placement for exact printing after running ExactPrint.makeDelta on ParsedSource. Add an additional test that explicitly tests this. - - - - - a462788f by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Make ValBinds LocatedA in HsLocalBindsLR If we have items with an AnnList Annotation, as part of another, which has different content, it must be LocatedA. This is a technical requirement due to the way comment allocation happens during the makeDelta processing. Comments are queued for printing, and as soon as any non-comment is to be printed, the pending comments before that position are printed, and in makeDelta processing these attached as preceding comments to the thing just printed. The means they end up captured inside the layout region of the AnnList item. So for foo = x where -- comment x = 3 the comment ends up as a preceding comment of `x = 3`, inside the layout, and prints as foo = x where -- comment x = 3 - - - - - 366a7f4c by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Make IPBinds LocatedA - - - - - 859c4ead by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Make ClsInstDecl decls LocatedA - - - - - 6333e313 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Make ClassDecls decls LocatedA - - - - - 5f5e4bd2 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Make ClosedTypeFamily equations Located For FamilyDecl/ClosedTypeFamily - - - - - ddb07ab0 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Make dd_cons located - - - - - 90ca508c by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Make HsMultiIf options located - - - - - e32e1d5d by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Make DecBrl contents LocatedA - - - - - d48bd4ed by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Located do statements - - - - - 5acd759a by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Print RecStmt located - - - - - d1d40ffb by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: HsCmdDo Located - - - - - a60b28fa by Alan Zimmerman at 2026-09-27T10:11:11+01:00 Extend Test20297 for additional occurrences - - - - - cef6a257 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Tweak PatSynBind location for comments - - - - - 4d9588bc by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: WIP, add test for where ;; ValBinds - - - - - fc91c514 by Alan Zimmerman at 2026-09-27T10:11:11+01:00 EPA: Make EpVirtualBraces noSpanAnchor if no contents Otherwise the vocurly is emitted at the start of the next item parsed Check: is this needed, or just a check for empty contents? - - - - - 9914ff22 by Alan Zimmerman at 2026-09-27T16:09:47+01:00 EPA: Use EpNoLayout in AnnList with empty contents and no explicit braces TODO: get rid of unused first arg to epVirtualBraces - - - - - c13ed1d8 by Alan Zimmerman at 2026-09-27T16:10:19+01:00 TODO: XClassDecl: remove additional EpLayout - - - - - fd49b138 by Alan Zimmerman at 2026-09-27T16:10:19+01:00 WIP: turn off exactprint debug printing - - - - - 2ca50511 by Alan Zimmerman at 2026-09-27T16:10:19+01:00 EPA: Remove CanUpdateAnchorOnly - - - - - 53f9429e by Alan Zimmerman at 2026-09-27T16:10:19+01:00 EPA: Sync with ghc-exactprint after EPWriter -> CPS - - - - - eb753e22 by Alan Zimmerman at 2026-09-27T18:43:49+01:00 EPA: Fix EpVirtualBraces for HsDo The start of layout must include the leading semi, so we comb3 to ensure it is included if the initial stmts are empty - - - - - 23f600c3 by Alan Zimmerman at 2026-09-27T18:45:21+01:00 Plan update DO NOT COMMIT - - - - - 3ba8e610 by Alan Zimmerman at 2026-09-27T18:45:21+01:00 EPA: First pass implementation of HsList, for ClassDecls Just as a straight list replacement to start with, no payload. This shows the scope and invasiveness of the initial change - - - - - badd3010 by Alan Zimmerman at 2026-09-27T18:45:21+01:00 EPA: HsList attempt WIP - - - - - 850a5f08 by Alan Zimmerman at 2026-09-27T18:45:21+01:00 Enable ppr test for Haddock1. It currently fails - - - - - f1d8367c by Alan Zimmerman at 2026-09-27T18:45:21+01:00 WIP on removing NoEpAnn. Likely abandon - - - - - 26d9b114 by Alan Zimmerman at 2026-09-27T18:45:21+01:00 EPA: Add an overview doc for exact printing - - - - - 0a75a65b by Simon Peyton Jones at 2026-09-27T18:45:21+01:00 Added an intro section - - - - - 115 changed files: - .gitlab-ci.yml - + ANNLIST-LAYOUT-PLAN.md - + ExactPrint.md - + LAYOUT-SCOPE-PLAN.md - compiler/GHC/Core/Opt/WorkWrap/Utils.hs - compiler/GHC/Driver/Backpack.hs - compiler/GHC/Driver/Downsweep.hs - compiler/GHC/Driver/Errors/Ppr.hs - compiler/GHC/Driver/Errors/Types.hs - compiler/GHC/Driver/Main/Interactive.hs - compiler/GHC/Hs.hs - compiler/GHC/Hs/Binds.hs - compiler/GHC/Hs/Decls.hs - compiler/GHC/Hs/DocString.hs - compiler/GHC/Hs/Dump.hs - compiler/GHC/Hs/Expr.hs - compiler/GHC/Hs/ImpExp.hs - compiler/GHC/Hs/Instances.hs - compiler/GHC/Hs/Stats.hs - compiler/GHC/Hs/Utils.hs - compiler/GHC/HsToCore/Arrows.hs - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/HsToCore/Expr.hs - compiler/GHC/HsToCore/Expr.hs-boot - compiler/GHC/HsToCore/Match.hs - compiler/GHC/HsToCore/Pmc/Desugar.hs - compiler/GHC/HsToCore/Quote.hs - compiler/GHC/HsToCore/Ticks.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Parser/PostProcess/Haddock.hs - compiler/GHC/Rename/Bind.hs - compiler/GHC/Rename/Expr.hs - compiler/GHC/Rename/Module.hs - compiler/GHC/Rename/Names.hs - compiler/GHC/Rename/Splice.hs - compiler/GHC/Rename/Utils.hs - compiler/GHC/Runtime/Eval.hs - compiler/GHC/Tc/Deriv.hs - compiler/GHC/Tc/Deriv/Functor.hs - compiler/GHC/Tc/Deriv/Generate.hs - compiler/GHC/Tc/Gen/Arrow.hs - compiler/GHC/Tc/Gen/Bind.hs - compiler/GHC/Tc/Gen/Expr.hs - compiler/GHC/Tc/Gen/Match.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/TyCl.hs - compiler/GHC/Tc/TyCl/Instance.hs - compiler/GHC/Tc/TyCl/PatSyn.hs - compiler/GHC/Tc/Types/Origin.hs - compiler/GHC/Tc/Utils/Env.hs - compiler/GHC/Tc/Zonk/Type.hs - compiler/GHC/ThToHs.hs - compiler/GHC/Unit/Env.hs - compiler/GHC/Unit/State.hs - compiler/Language/Haskell/Syntax.hs - compiler/Language/Haskell/Syntax/Basic.hs - compiler/Language/Haskell/Syntax/Binds.hs - compiler/Language/Haskell/Syntax/Decls.hs - compiler/Language/Haskell/Syntax/Expr.hs - compiler/Language/Haskell/Syntax/Extension.hs - ghc/GHCi/UI.hs - hadrian/ghci-multi-cabal.in - testsuite/tests/driver/multipleHomeUnits/mhu-closure/Makefile - testsuite/tests/driver/multipleHomeUnits/mhu-closure/mhu-closure.stderr - testsuite/tests/driver/multipleHomeUnits/mhu-closure/mhu-closure.stdout - testsuite/tests/ghc-api/exactprint/T22919.stderr - testsuite/tests/ghc-api/exactprint/Test20239.stderr - testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr - testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr - testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr - testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr - testsuite/tests/module/mod185.stderr - testsuite/tests/parser/should_compile/DumpParsedAst.stderr - testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr - testsuite/tests/parser/should_compile/DumpRenamedAst.stderr - testsuite/tests/parser/should_compile/DumpSemis.hs - testsuite/tests/parser/should_compile/DumpSemis.stderr - testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr - testsuite/tests/parser/should_compile/KindSigs.stderr - testsuite/tests/parser/should_compile/T14189.stderr - testsuite/tests/parser/should_compile/T15279.stderr - testsuite/tests/parser/should_compile/T15323.stderr - testsuite/tests/parser/should_compile/T20452.stderr - testsuite/tests/parser/should_compile/T20718.stderr - testsuite/tests/parser/should_compile/T20718b.stderr - testsuite/tests/parser/should_compile/T20846.stderr - testsuite/tests/parser/should_compile/T23315/T23315.stderr - testsuite/tests/perf/compiler/hard_hole_fits.stderr - testsuite/tests/printer/AnnotationNoListTuplePuns.stdout - + testsuite/tests/printer/Layout.hs - testsuite/tests/printer/Makefile - testsuite/tests/printer/Ppr003.hs - testsuite/tests/printer/T18791.stderr - + testsuite/tests/printer/Test20297.expected.hs - testsuite/tests/printer/Test20297.hs - testsuite/tests/printer/Test20297.stdout - + testsuite/tests/printer/Test20297MD.stdout - testsuite/tests/printer/Test24533.stdout - testsuite/tests/printer/all.T - utils/check-exact/ExactPrint.hs - utils/check-exact/Main.hs - utils/check-exact/Parsers.hs - utils/check-exact/Transform.hs - utils/check-exact/Utils.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/-/compare/88562119b53de864156349b1b274f71... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/88562119b53de864156349b1b274f71... 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)
-
Alan Zimmerman (@alanz)