Alan Zimmerman pushed to branch wip/az/exactprint-annotation-rationalisation at Glasgow Haskell Compiler / GHC Commits: 545fd4fb by ARATA Mizuki at 2026-09-22T15:03:24-04:00 Change the C types of hs_{bitrev,bswap}{16,32} to match the Haskell types bitReverse{16,32}# and byteSwap{16,32}# have the type Word# -> Word#, but their C correspondents took and returned StgWord{16,32}. The mismatch on bitReverse16# led to the problem reported in #27299. Although no similar issue is reported for bitReverse32# and byteSwap{16,32}#, it seemed wise to change them proactively. This commit fixes the mismatch by changing the C type. Fixes #27299 - - - - - bf17f289 by fendor at 2026-09-22T15:04:05-04:00 Don't lose instances from shadowed imported modules with the same name When we look for instances below the current module, we need to check the unit id as well when we check for whether the module is the current module, otherwise we ignore modules we import that have the same name as the import module. Adds regression test. - - - - - bd9b258a by Alan Zimmerman at 2026-09-23T15:23:41+01: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. - - - - - 18fff7bf by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Use EpaLocation in EpVirtualBraces reword: 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. - - - - - 66eef6ef by Alan Zimmerman at 2026-09-23T15:26:53+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. - - - - - e006c3cc by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: AnnList clean up patch for empty where clause - - - - - c49da845 by Alan Zimmerman at 2026-09-23T15:26:53+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 - - - - - 37a82a15 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 WIP annclassdecl - - - - - 275673e0 by Alan Zimmerman at 2026-09-23T15:26:53+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 - - - - - fdf60bb6 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Tidy up markAnnListA' It takes an action which can modify the AnnList, but this is never used. So remove it. - - - - - a1814bc6 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Use AnnList for GADT declarations - - - - - c16d3334 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Use AnnList in AnnClassDecl - - - - - 977d5d70 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 MOVE EPA: Plan for Fixing AnnList Layout Properly - - - - - 2b939090 by Alan Zimmerman at 2026-09-23T15:26:53+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. - - - - - 2335ce8f by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Use AnnList in HsMultiIf It introduces layout, capture it - - - - - d8659ea3 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Use AnnList in DecBrl - - - - - 41cfe430 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Replace AnnListLayout / AnnListBrackets with EpLayout - - - - - ceb37c77 by Alan Zimmerman at 2026-09-23T15:26:53+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 - - - - - 739934cb by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA some tests for layout. WIP - - - - - 962c7967 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 Exactprint layout scope plan. Do not commit - - - - - 5336604f by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: tidy up a bit. Combine somewhere else - - - - - bc5c1431 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Introduce LayoutFrame stacks in ExactPrint state - - - - - 34e2f42c by Alan Zimmerman at 2026-09-23T15:26:53+01:00 Align with ghc-exactprint - - - - - 727725f1 by Alan Zimmerman at 2026-09-23T15:26:53+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 - - - - - 0c55ef4b by Alan Zimmerman at 2026-09-23T15:26:53+01:00 Exactprint: tidy up layout capturing - - - - - 8ea21bf4 by Alan Zimmerman at 2026-09-23T15:26:53+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. - - - - - 4e2a2823 by Alan Zimmerman at 2026-09-23T15:26:53+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 - - - - - c5a1b1c2 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Make IPBinds LocatedA - - - - - 266ba0c7 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Make ClsInstDecl decls LocatedA - - - - - 281fd5ef by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Make ClassDecls decls LocatedA - - - - - 485adbaa by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Make ClosedTypeFamily equations Located For FamilyDecl/ClosedTypeFamily - - - - - dad22bd7 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Make dd_cons located - - - - - a18f4dd4 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Make HsMultiIf options located - - - - - 5d41afbd by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Make DecBrl contents LocatedA - - - - - 89eaed44 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Located do statements - - - - - 84406448 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Print RecStmt located - - - - - 897da1a6 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: HsCmdDo Located - - - - - d5eb9015 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 Extend Test20297 for additional occurrences - - - - - f260acd6 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Tweak PatSynBind location for comments - - - - - 84528cc5 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: WIP, add test for where ;; ValBinds - - - - - a80d3263 by Alan Zimmerman at 2026-09-23T15:26:53+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? - - - - - 9dd58d8e by Alan Zimmerman at 2026-09-23T15:26:53+01:00 WIP: turn of exactprint debug printing - - - - - cdcbfb30 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Remove CanUpdateAnchorOnly - - - - - 55d692b0 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 Plan update DO NOT COMMIT - - - - - 7ea8771f by Alan Zimmerman at 2026-09-23T15:26:53+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 - - - - - ef05ddb4 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: HsList attempt WIP - - - - - c879ec1b by Alan Zimmerman at 2026-09-23T15:26:53+01:00 Enable ppr test for Haddock1. It currently fails - - - - - dfc8bb36 by Alan Zimmerman at 2026-09-23T15:26:53+01:00 WIP on removing NoEpAnn. Likely abandon - - - - - 58b8761a by Alan Zimmerman at 2026-09-23T15:26:53+01:00 EPA: Add an overview doc for exact printing - - - - - 8ebd722d by Simon Peyton Jones at 2026-09-23T15:26:53+01:00 Added an intro section - - - - - 120 changed files: - + ANNLIST-LAYOUT-PLAN.md - + ExactPrint.md - + LAYOUT-SCOPE-PLAN.md - + changelog.d/26610 - compiler/GHC/Driver/Backpack.hs - compiler/GHC/Driver/Env.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/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 - rts/include/stg/Prim.h - rts/prim/bitrev.c - rts/prim/bswap.c - testsuite/tests/ghc-api/exactprint/T22919.stderr - testsuite/tests/ghc-api/exactprint/Test20239.stderr - testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr - + testsuite/tests/ghci/prog-mhu008/Makefile - + testsuite/tests/ghci/prog-mhu008/a/M.hs - + testsuite/tests/ghci/prog-mhu008/all.T - + testsuite/tests/ghci/prog-mhu008/b/M.hs - + testsuite/tests/ghci/prog-mhu008/prog-mhu008.script - + testsuite/tests/ghci/prog-mhu008/prog-mhu008.stdout - + testsuite/tests/ghci/prog-mhu008/unitA - + testsuite/tests/ghci/prog-mhu008/unitB - 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/primops/should_run/T27299.hs - + testsuite/tests/primops/should_run/T27299.stdout - testsuite/tests/primops/should_run/all.T - 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/816483fb4adca4e39fd61a74a2591e1... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/816483fb4adca4e39fd61a74a2591e1... 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