Fix #15502 by not casting to Int during TH conversion
authorRyan Scott <ryan.gl.scott@gmail.com>
Mon, 27 Aug 2018 12:02:49 +0000 (14:02 +0200)
committerKrzysztof Gogolewski <krz.gogolewski@gmail.com>
Mon, 27 Aug 2018 12:03:34 +0000 (14:03 +0200)
commit7a3cda534d1447c813aa37cdd86e20b8d782cb02
tree7f266adf199eb3c26a387bdd20357699c49dbe13
parent5e6cf2a9301a5473ff9c5319b96de941b1ad72dd
Fix #15502 by not casting to Int during TH conversion

Summary:
When turning an `IntegerL` to an `IntegralLit` during TH
conversion, we were stupidly casting an `Integer` to an `Int` in
order to determine how it should be pretty-printed. Unsurprisingly,
this causes problems when the `Integer` doesn't lie within the bounds
of an `Int`, as demonstrated in #15502.

The fix is simple: don't cast to an `Int`.

Test Plan: make test TEST=T15502

Reviewers: bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, carter

GHC Trac Issues: #15502

Differential Revision: https://phabricator.haskell.org/D5089
compiler/basicTypes/BasicTypes.hs
testsuite/tests/th/T15502.hs [new file with mode: 0644]
testsuite/tests/th/T15502.stderr [new file with mode: 0644]
testsuite/tests/th/all.T