Fix #15572 by checking for promoted names in ConT
authorRyan Scott <ryan.gl.scott@gmail.com>
Tue, 28 Aug 2018 18:54:28 +0000 (20:54 +0200)
committerBen Gamari <ben@smart-cactus.org>
Sun, 16 Sep 2018 16:31:17 +0000 (12:31 -0400)
commitebc8ebf89332ddac3039ff87331c4c053ae516ea
treee9f3470387c298fa8d9f3d6edec4728cec9523d7
parent2cdb2de12ce4a96269cfa5fcd69dabfc4eb99786
Fix #15572 by checking for promoted names in ConT

Summary:
When converting `ConT`s to `HsTyVar`s in `Convert`, we were
failing to account for the possibility of promoted data constructor
names appearing in a `ConT`, which could result in improper
pretty-printing results (as observed in #15572). The fix is
straightforward: use `Promoted` instead of `NotPromoted` when the
name of a `ConT` is a data constructor name.

Test Plan: make test TEST=T15572

Reviewers: goldfire, bgamari, simonpj, monoidal

Reviewed By: goldfire, simonpj

Subscribers: monoidal, rwbarton, carter

GHC Trac Issues: #15572

Differential Revision: https://phabricator.haskell.org/D5112

(cherry picked from commit c46a5f2002f6694ea58f79f505d57f3b7bd450e7)
compiler/hsSyn/Convert.hs
testsuite/tests/th/T15572.hs [new file with mode: 0644]
testsuite/tests/th/T15572.stderr [new file with mode: 0644]
testsuite/tests/th/all.T