Don't warn about name shadowing when renaming the patten in a PatSyn decl
ClosedPublic

Authored by mpickering on Sep 24 2016, 11:21 AM.

Details

Summary

Previously the renamer assumed that *any* time we renamed a
pattern, the pattern was introducing new binders. This isn't true
in pattern synonym declarations where the pattern is used as part of
a definition.

We add a special case to not warn in this situation.

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mpickering updated this revision to Diff 8766.Sep 24 2016, 11:21 AM
mpickering retitled this revision from to Don't warn about name shadowing when renaming the patten in a PatSyn decl.
mpickering updated this object.
mpickering edited the test plan for this revision. (Show Details)
mpickering updated the Trac tickets for this revision.
simonpj accepted this revision.Sep 24 2016, 12:49 PM
simonpj added a reviewer: simonpj.
simonpj added a subscriber: simonpj.

Great, modulo comment

compiler/rename/RnPat.hs
315–320

Good.

Better:

; unless (isPatSynCtxt ctxt) $
      -- See Note [Don't report shardowing for pattern synonyms]
  addErrCtxt doc_pat $
  checkDupAndShadowedNames envs_before $
  collectPatsBinders pats'

And in the Note can you give a short example?

This revision is now accepted and ready to land.Sep 24 2016, 12:49 PM
mpickering updated this revision to Diff 8767.Sep 24 2016, 1:19 PM
mpickering edited edge metadata.
  • Account for Simon's comments

Thanks Simon. I updated the diff to reflect your comments.

This revision was automatically updated to reflect the committed changes.