Check if -XStaticPointers is enabled when renaming static expressions
authorRyan Scott <ryan.gl.scott@gmail.com>
Wed, 13 Sep 2017 13:37:13 +0000 (09:37 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Wed, 13 Sep 2017 13:37:13 +0000 (09:37 -0400)
commit9ff9c35895ecc072f289c93addd1faad884bf122
tree30707ea1b2139ecd555f5352d85cee0bf17f0718
parent0ebc8dc3525ddaa04a0c9e4c0c1aef70fd3fe725
Check if -XStaticPointers is enabled when renaming static expressions

Summary:
Trying to use `static` expressions without the `-XStaticPointers`
extension enabled can lead to runtime errors. Normally, such a situation isn't
possible, but Template Haskell provides a backdoor that allows it to happen,
as shown in #14204.

To prevent this, we ensure that `-XStaticPointers` is enabled when renaming
`static` expressions.

Test Plan: make test TEST=T14204

Reviewers: facundominguez, austin, bgamari, simonpj

Reviewed By: facundominguez, simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #14204

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