Properly designate LambdaCase alts as CaseAlt in TH
authorRyan Scott <ryan.gl.scott@gmail.com>
Tue, 14 Aug 2018 20:35:23 +0000 (22:35 +0200)
committerBen Gamari <ben@smart-cactus.org>
Thu, 23 Aug 2018 22:50:28 +0000 (18:50 -0400)
commite57a15d820b44751fcfc14c056ae284caab697a6
treed6f763702007f8e397520ee4b525e758c22c95d7
parent89ad5fed345d54ed73ecb3057346f3ef81864c8c
Properly designate LambdaCase alts as CaseAlt in TH

Summary:
When `\case` expressions are parsed normally, their
alternatives are marked as `CaseAlt` (which means that they are
pretty-printed without a `\` character in front of them, unlike for
lambda expressions). However, `\case` expressions created by way of
Template Haskell (in `Convert`) inconsistently designated the case
alternatives as `LambdaExpr`, causing them to be pretty-printed
poorly (as shown in #15518). The fix is simple: use `CaseAlt`
consistently.

Test Plan: make test TEST=T15518

Reviewers: goldfire, bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #15518

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

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