Only use locally bound variables in pattern synonym declarations
authorMatthew Pickering <matthewtpickering@gmail.com>
Mon, 27 Mar 2017 10:24:25 +0000 (11:24 +0100)
committerMatthew Pickering <matthewtpickering@gmail.com>
Mon, 27 Mar 2017 10:25:02 +0000 (11:25 +0100)
commitd819e416a2a537b78b2698dfe753aa68dfb8b837
treee602d2b7efa7ce680284b8e47a7827909204bf0d
parenta6ce7f338c88920f380a2ed3f3f82b0184aeb341
Only use locally bound variables in pattern synonym declarations

Summary:
We were using the unconstrainted `lookupOccRn` function which looked up
any variable in scope. Instead we only want to consider variables brought into
scope by renaming the pattern on the RHS.

A few more changes to make reporting of unbound names suggest the correct
things.

Fixes #13470

Reviewers: simonpj, austin, bgamari

Reviewed By: simonpj

Subscribers: rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D3377
compiler/rename/RnBinds.hs
compiler/rename/RnEnv.hs
testsuite/tests/patsyn/should_fail/T13470.hs [new file with mode: 0644]
testsuite/tests/patsyn/should_fail/T13470.stderr [new file with mode: 0644]
testsuite/tests/patsyn/should_fail/all.T