[Git][ghc/ghc][master] Lint should say when it is checking a rule

Marge Bot gitlab at gitlab.haskell.org
Thu May 21 16:12:27 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
24e61aad by Ben Price at 2020-05-21T12:12:17-04:00
Lint should say when it is checking a rule

It is rather confusing that when lint finds an error in a rule attached
to a binder, it reports the error as in the RHS, not the rule:
  ...
  In the RHS of foo

We add a clarifying line:
  ...
  In the RHS of foo
  In a rule attached to foo

The implication that the rule lives inside the RHS is a bit odd, but
this niggle is already present for unfoldings, whose pattern we are
following.

- - - - -


1 changed file:

- compiler/GHC/Core/Lint.hs


Changes:

=====================================
compiler/GHC/Core/Lint.hs
=====================================
@@ -659,7 +659,7 @@ lintLetBind top_lvl rec_flag binder rhs rhs_ty
                ppr binder)
            _ -> return ()
 
-       ; mapM_ (lintCoreRule binder binder_ty) (idCoreRules binder)
+       ; addLoc (RuleOf binder) $ mapM_ (lintCoreRule binder binder_ty) (idCoreRules binder)
 
        ; addLoc (UnfoldingOf binder) $
          lintIdUnfolding binder binder_ty (idUnfolding binder) }
@@ -2293,6 +2293,7 @@ data LintLocInfo
   = RhsOf Id            -- The variable bound
   | OccOf Id            -- Occurrence of id
   | LambdaBodyOf Id     -- The lambda-binder
+  | RuleOf Id           -- Rules attached to a binder
   | UnfoldingOf Id      -- Unfolding of a binder
   | BodyOfLetRec [Id]   -- One of the binders
   | CaseAlt CoreAlt     -- Case alternative
@@ -2511,6 +2512,9 @@ dumpLoc (OccOf v)
 dumpLoc (LambdaBodyOf b)
   = (getSrcLoc b, text "In the body of lambda with binder" <+> pp_binder b)
 
+dumpLoc (RuleOf b)
+  = (getSrcLoc b, text "In a rule attached to" <+> pp_binder b)
+
 dumpLoc (UnfoldingOf b)
   = (getSrcLoc b, text "In the unfolding of" <+> pp_binder b)
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/24e61aad37355fa3a5503b11a60ab7b314a3f405

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/24e61aad37355fa3a5503b11a60ab7b314a3f405
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/20200521/d185d486/attachment-0001.html>


More information about the ghc-commits mailing list