Commit 5ba01d83 authored by Ben Price's avatar Ben Price Committed by Marge Bot
Browse files

Clarify a Lint message

When developing a plugin I had a shadowing problem, where I generated
  app = \f{v r7B} x{v r7B} -> f{v r7B} x{v r7B}
This is obviously wrong, since the occurrence of `f` to the right of the
arrow refers to the `x` binder (they share a Unique). However, it is
rather confusing when Lint reports
  Mismatch in type between binder and occurrence
  Var: x{v rB7}
since it is printing the binder, rather than the occurrence.
It is rather easy to read this as claiming there is something wrong with
the `x` occurrence!

We change the report to explicitly print both the binder and the
occurrence variables.
parent 5fa9cb82
......@@ -2729,9 +2729,8 @@ mkJoinBndrOccMismatchMsg bndr join_arity_bndr join_arity_occ
mkBndrOccTypeMismatchMsg :: Var -> Var -> OutType -> OutType -> SDoc
mkBndrOccTypeMismatchMsg bndr var bndr_ty var_ty
= vcat [ text "Mismatch in type between binder and occurrence"
, text "Var:" <+> ppr bndr
, text "Binder type:" <+> ppr bndr_ty
, text "Occurrence type:" <+> ppr var_ty
, text "Binder:" <+> ppr bndr <+> dcolon <+> ppr bndr_ty
, text "Occurrence:" <+> ppr var <+> dcolon <+> ppr var_ty
, text " Before subst:" <+> ppr (idType var) ]
mkBadJoinPointRuleMsg :: JoinId -> JoinArity -> CoreRule -> SDoc
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment