Fix #13968 by consulting isBuiltInOcc_maybe
authorRyan Scott <ryan.gl.scott@gmail.com>
Wed, 26 Jul 2017 21:13:57 +0000 (17:13 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Wed, 26 Jul 2017 21:13:58 +0000 (17:13 -0400)
commitd774b4e2de4f07d2432b67010305fede7aeefc78
tree51c22c94ec98bae38d04603e34df54c7a7a85e8a
parent362339dd4cfd652b63c7cd1b7ea5a7486bb40944
Fix #13968 by consulting isBuiltInOcc_maybe

Summary:
We were unconditionally reporting `Illegal binding of built-in syntax`
in an error message, but this error doesn't make sense in certain Template
Haskell scenarios which can trigger it. Let's give a more sensible error
message by first checking if the name we're binding really is built-in syntax,
using the handy `isBuiltInOcc_maybe` function.

Test Plan: make test TEST=T13968

Reviewers: bgamari, austin, goldfire

Reviewed By: goldfire

Subscribers: goldfire, rwbarton, thomie

GHC Trac Issues: #13968

Differential Revision: https://phabricator.haskell.org/D3789
compiler/rename/RnEnv.hs
testsuite/tests/th/T13968.hs [new file with mode: 0644]
testsuite/tests/th/T13968.stderr [new file with mode: 0644]
testsuite/tests/th/all.T