[Git][ghc/ghc][wip/andreask/note-lint] lint notes: Add more info to notes.stdout

Andreas Klebinger (@AndreasK) gitlab at gitlab.haskell.org
Mon May 27 16:27:28 UTC 2024



Andreas Klebinger pushed to branch wip/andreask/note-lint at Glasgow Haskell Compiler / GHC


Commits:
882cca76 by Andreas Klebinger at 2024-05-27T18:11:27+02:00
lint notes: Add more info to notes.stdout

When fixing a note reference CI fails with a somewhat confusing diff.
See #21123. This commit adds a line to the output file being compared
which hopefully makes it clear this is the list of broken refs, not all
refs.

Fixes #21123

- - - - -


2 changed files:

- linters/lint-notes/Main.hs
- testsuite/tests/linters/notes.stdout


Changes:

=====================================
linters/lint-notes/Main.hs
=====================================
@@ -37,7 +37,9 @@ main = do
         parseMode "unreferenced" = Just $ printNoteDefs . S.toList . unreferencedNotes
         parseMode "defs"         = Just $ printNoteDefs . allNoteDefs
         parseMode "refs"         = Just $ printNoteRefs . allNoteRefs
-        parseMode "broken-refs"  = Just $ printNoteRefs . map fst . brokenNoteRefs
+        parseMode "broken-refs"  = Just $ \notedb -> do
+          putStrLn "Listing broken refs:"
+          printNoteRefs . map fst . brokenNoteRefs $ notedb
         parseMode "broken-refs-suggest" = Just $ mapM_ printNoteRefsSugg . brokenNoteRefs
         parseMode _              = Nothing
 


=====================================
testsuite/tests/linters/notes.stdout
=====================================
@@ -1,39 +1,40 @@
+Listing broken refs:
 ref    compiler/GHC/Core/Coercion/Axiom.hs:472:2:     Note [RoughMap and rm_empty]
 ref    compiler/GHC/Core/Opt/OccurAnal.hs:1157:7:     Note [Loop breaking]
-ref    compiler/GHC/Core/Opt/SetLevels.hs:1586:30:     Note [Top level scope]
-ref    compiler/GHC/Core/Opt/Simplify/Iteration.hs:2832:13:     Note [Case binder next]
-ref    compiler/GHC/Core/Opt/Simplify/Iteration.hs:4023:8:     Note [Lambda-bound unfoldings]
-ref    compiler/GHC/Core/Opt/Simplify/Utils.hs:1342:37:     Note [Gentle mode]
+ref    compiler/GHC/Core/Opt/SetLevels.hs:1688:30:     Note [Top level scope]
+ref    compiler/GHC/Core/Opt/Simplify/Iteration.hs:2937:13:     Note [Case binder next]
+ref    compiler/GHC/Core/Opt/Simplify/Iteration.hs:4253:8:     Note [Lambda-bound unfoldings]
+ref    compiler/GHC/Core/Opt/Simplify/Utils.hs:1406:37:     Note [Gentle mode]
 ref    compiler/GHC/Core/Opt/Specialise.hs:1763:29:     Note [Arity decrease]
-ref    compiler/GHC/Core/TyCo/Rep.hs:1652:31:     Note [What prevents a constraint from floating]
-ref    compiler/GHC/Driver/DynFlags.hs:1251:52:     Note [Eta-reduction in -O0]
-ref    compiler/GHC/Driver/Main.hs:1749:34:     Note [simpleTidyPgm - mkBootModDetailsTc]
-ref    compiler/GHC/Hs/Expr.hs:191:63:     Note [Pending Splices]
-ref    compiler/GHC/Hs/Expr.hs:1727:87:     Note [Lifecycle of a splice]
-ref    compiler/GHC/Hs/Expr.hs:1763:7:     Note [Pending Splices]
-ref    compiler/GHC/Hs/Extension.hs:147:5:     Note [Strict argument type constraints]
-ref    compiler/GHC/Hs/Pat.hs:141:74:     Note [Lifecycle of a splice]
+ref    compiler/GHC/Core/TyCo/Rep.hs:1677:31:     Note [What prevents a constraint from floating]
+ref    compiler/GHC/Driver/DynFlags.hs:1254:52:     Note [Eta-reduction in -O0]
+ref    compiler/GHC/Driver/Main.hs:1750:34:     Note [simpleTidyPgm - mkBootModDetailsTc]
+ref    compiler/GHC/Hs/Expr.hs:192:63:     Note [Pending Splices]
+ref    compiler/GHC/Hs/Expr.hs:1955:87:     Note [Lifecycle of a splice]
+ref    compiler/GHC/Hs/Expr.hs:1991:7:     Note [Pending Splices]
+ref    compiler/GHC/Hs/Extension.hs:144:5:     Note [Strict argument type constraints]
+ref    compiler/GHC/Hs/Pat.hs:146:74:     Note [Lifecycle of a splice]
 ref    compiler/GHC/HsToCore/Pmc/Solver.hs:856:20:     Note [COMPLETE sets on data families]
-ref    compiler/GHC/HsToCore/Quote.hs:1487:7:     Note [How brackets and nested splices are handled]
-ref    compiler/GHC/Stg/Unarise.hs:438:32:     Note [Renaming during unarisation]
-ref    compiler/GHC/Tc/Gen/HsType.hs:556:56:     Note [Skolem escape prevention]
-ref    compiler/GHC/Tc/Gen/HsType.hs:2676:7:     Note [Matching a kind signature with a declaration]
-ref    compiler/GHC/Tc/Gen/Pat.hs:174:20:     Note [Typing patterns in pattern bindings]
-ref    compiler/GHC/Tc/Gen/Pat.hs:1163:7:     Note [Matching polytyped patterns]
-ref    compiler/GHC/Tc/Gen/Sig.hs:80:10:     Note [Overview of type signatures]
+ref    compiler/GHC/HsToCore/Quote.hs:1505:7:     Note [How brackets and nested splices are handled]
+ref    compiler/GHC/Stg/Unarise.hs:451:32:     Note [Renaming during unarisation]
+ref    compiler/GHC/Tc/Gen/HsType.hs:561:56:     Note [Skolem escape prevention]
+ref    compiler/GHC/Tc/Gen/HsType.hs:2707:7:     Note [Matching a kind signature with a declaration]
+ref    compiler/GHC/Tc/Gen/Pat.hs:286:20:     Note [Typing patterns in pattern bindings]
+ref    compiler/GHC/Tc/Gen/Pat.hs:1385:7:     Note [Matching polytyped patterns]
+ref    compiler/GHC/Tc/Gen/Sig.hs:77:10:     Note [Overview of type signatures]
 ref    compiler/GHC/Tc/Gen/Splice.hs:358:16:     Note [How brackets and nested splices are handled]
 ref    compiler/GHC/Tc/Gen/Splice.hs:533:35:     Note [PendingRnSplice]
-ref    compiler/GHC/Tc/Gen/Splice.hs:657:7:     Note [How brackets and nested splices are handled]
-ref    compiler/GHC/Tc/Gen/Splice.hs:891:11:     Note [How brackets and nested splices are handled]
+ref    compiler/GHC/Tc/Gen/Splice.hs:660:7:     Note [How brackets and nested splices are handled]
+ref    compiler/GHC/Tc/Gen/Splice.hs:904:11:     Note [How brackets and nested splices are handled]
 ref    compiler/GHC/Tc/Instance/Family.hs:406:35:     Note [Constrained family instances]
-ref    compiler/GHC/Tc/Solver/Rewrite.hs:1010:7:     Note [Stability of rewriting]
+ref    compiler/GHC/Tc/Solver/Rewrite.hs:1006:7:     Note [Stability of rewriting]
 ref    compiler/GHC/Tc/TyCl.hs:1316:6:     Note [Unification variables need fresh Names]
 ref    compiler/GHC/Tc/Types/Constraint.hs:206:38:     Note [NonCanonical Semantics]
-ref    compiler/GHC/Types/Demand.hs:301:25:     Note [Preserving Boxity of results is rarely a win]
+ref    compiler/GHC/Types/Demand.hs:303:25:     Note [Preserving Boxity of results is rarely a win]
 ref    compiler/GHC/Unit/Module/Deps.hs:83:13:     Note [Structure of dep_boot_mods]
 ref    compiler/GHC/Utils/Monad.hs:410:34:     Note [multiShotIO]
-ref    compiler/Language/Haskell/Syntax/Binds.hs:200:31:     Note [fun_id in Match]
-ref    configure.ac:203:10:     Note [Linking ghc-bin against threaded stage0 RTS]
+ref    compiler/Language/Haskell/Syntax/Binds.hs:220:31:     Note [fun_id in Match]
+ref    configure.ac:191:10:     Note [Linking ghc-bin against threaded stage0 RTS]
 ref    docs/core-spec/core-spec.mng:177:6:     Note [TyBinders]
 ref    hadrian/src/Expression.hs:145:30:     Note [Linking ghc-bin against threaded stage0 RTS]
 ref    linters/lint-notes/Notes.hs:32:29:     Note [" <> T.unpack x <> "]
@@ -51,18 +52,18 @@ ref    testsuite/tests/typecheck/should_compile/tc228.hs:9:7:     Note [Inferenc
 ref    testsuite/tests/typecheck/should_compile/tc231.hs:12:16:     Note [Important subtlety in oclose]
 ref    testsuite/tests/typecheck/should_fail/UnliftedNewtypesMultiFieldGadt.hs:11:28:     Note [Kind-checking the field type]
 ref    testsuite/tests/typecheck/should_fail/tcfail093.hs:13:7:     Note [Important subtlety in oclose]
-ref    utils/haddock/haddock-api/src/Haddock/Convert.hs<line>:<no>:     Note [Eta reduction for data family axioms]
-ref    utils/haddock/haddock-api/src/Haddock/Convert.hs<line>:<no>:     Note [Invariant: Never expand type synonyms]
-ref    utils/haddock/haddock-api/src/Haddock/Convert.hs<line>:<no>:     Note [Invariant: Never expand type synonyms]
-ref    utils/haddock/haddock-api/src/Haddock/Convert.hs<line>:<no>:     Note [Invariant: Never expand type synonyms]
-ref    utils/haddock/haddock-api/src/Haddock/Convert.hs<line>:<no>:     Note [Invariant: Never expand type synonyms]
-ref    utils/haddock/haddock-api/src/Haddock/Convert.hs<line>:<no>:     Note [Invariant: Never expand type synonyms]
-ref    utils/haddock/haddock-api/src/Haddock/Convert.hs<line>:<no>:     Note [Invariant: Never expand type synonyms]
-ref    utils/haddock/haddock-api/src/Haddock/Convert.hs<line>:<no>:     Note [Invariant: Never expand type synonyms]
-ref    utils/haddock/haddock-api/src/Haddock/Convert.hs<line>:<no>:     Note [Invariant: Never expand type synonyms]
-ref    utils/haddock/haddock-api/src/Haddock/Interface/Create.hs<line>:<no>:     Note [Exporting built-in items]
-ref    utils/haddock/haddock-api/src/Haddock/Interface/Create.hs<line>:<no>:     Note [Exporting built-in items]
-ref    utils/haddock/haddock-api/src/Haddock/Interface/Create.hs<line>:<no>:     Note [Exporting built-in items]
-ref    utils/haddock/haddock-api/src/Haddock/InterfaceFile.hs<line>:<no>:     Note [The DocModule story]
-ref    utils/haddock/haddock-api/src/Haddock/Types.hs<line>:<no>:     Note [Pass sensitive types]
+ref    utils/haddock/haddock-api/src/Haddock/Convert.hs:1068:13:     Note [Eta reduction for data family axioms]
+ref    utils/haddock/haddock-api/src/Haddock/Convert.hs:1085:0:     Note [Invariant: Never expand type synonyms]
+ref    utils/haddock/haddock-api/src/Haddock/Convert.hs:1101:7:     Note [Invariant: Never expand type synonyms]
+ref    utils/haddock/haddock-api/src/Haddock/Convert.hs:1108:9:     Note [Invariant: Never expand type synonyms]
+ref    utils/haddock/haddock-api/src/Haddock/Convert.hs:1117:9:     Note [Invariant: Never expand type synonyms]
+ref    utils/haddock/haddock-api/src/Haddock/Convert.hs:1131:9:     Note [Invariant: Never expand type synonyms]
+ref    utils/haddock/haddock-api/src/Haddock/Convert.hs:1145:9:     Note [Invariant: Never expand type synonyms]
+ref    utils/haddock/haddock-api/src/Haddock/Convert.hs:1147:9:     Note [Invariant: Never expand type synonyms]
+ref    utils/haddock/haddock-api/src/Haddock/Convert.hs:1156:9:     Note [Invariant: Never expand type synonyms]
+ref    utils/haddock/haddock-api/src/Haddock/Interface/Create.hs:120:11:     Note [Exporting built-in items]
+ref    utils/haddock/haddock-api/src/Haddock/Interface/Create.hs:185:9:     Note [Exporting built-in items]
+ref    utils/haddock/haddock-api/src/Haddock/Interface/Create.hs:255:7:     Note [Exporting built-in items]
+ref    utils/haddock/haddock-api/src/Haddock/InterfaceFile.hs:118:3:     Note [The DocModule story]
+ref    utils/haddock/haddock-api/src/Haddock/Types.hs:17:3:     Note [Pass sensitive types]
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/882cca76bb7f984a2041775562ae301c744d7baa

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/882cca76bb7f984a2041775562ae301c744d7baa
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240527/3a5da078/attachment-0001.html>


More information about the ghc-commits mailing list