Fix #16385 by appending _maybe to a use of lookupGlobalOcc
authorRyan Scott <ryan.gl.scott@gmail.com>
Mon, 4 Mar 2019 14:52:14 +0000 (09:52 -0500)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Wed, 6 Mar 2019 21:05:45 +0000 (16:05 -0500)
commit78dd04f9126dc5df966070b8db4b39a517a9d99f
tree151aeab576581094c09d293a0f4157fcb3e8521b
parenta4944d8d98770b869f6aa5fb667877c56c3f8825
Fix #16385 by appending _maybe to a use of lookupGlobalOcc

`instance forall c. c` claimed that `c` was out of scope because the
renamer was invoking `lookupGlobalOcc` on `c` (in
`RnNames.getLocalNonValBinders`) without binding `c` first. To avoid
this, this patch changes GHC to invoke `lookupGlobalOcc_maybe` on `c`
instead, and if that returns `Nothing`, then bail out, resulting
in a better error message.
compiler/rename/RnNames.hs
testsuite/tests/rename/should_fail/T16385.hs [new file with mode: 0644]
testsuite/tests/rename/should_fail/T16385.stderr [new file with mode: 0644]
testsuite/tests/rename/should_fail/all.T