Fix API Annotations for unboxed sums
authorAlan Zimmerman <alan.zimm@gmail.com>
Tue, 10 Jan 2017 18:16:34 +0000 (20:16 +0200)
committerAlan Zimmerman <alan.zimm@gmail.com>
Tue, 17 Jan 2017 18:15:10 +0000 (20:15 +0200)
commit38f289fa2a8715d2d5869e144b764c35cba16c6a
treee6f1769a7c89bf2b517e4e9255f34712719d4899
parent715be013d40511771bb760647e4aff1b165ddd21
Fix API Annotations for unboxed sums

An unboxed tuple such as

    (# | b | | | | | #)

Ends up in the parser via `tup_exprs` as

    Sum 2 7 lexp

where `lexp` is a `LHsExpr`

From an API annotation perspective, the 5 `AnnVbar`s after the `b` were attached
to `lexp`, but the leading `AnnVbar`s did not have a home.

This patch attaches them all to the the parent tuple expression. The first (alt
- 1) of them come before `lexp`, and the remaining (arity - alt) come after.

Test Plan: ./validate

Reviewers: osa1, austin, bgamari

Subscribers: thomie, mpickering

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

GHC Trac Issues: #12417
compiler/hsSyn/HsExpr.hs
compiler/parser/Parser.y
testsuite/driver/extra_files.py
testsuite/tests/ghc-api/annotations/Makefile
testsuite/tests/ghc-api/annotations/T12417.stdout [new file with mode: 0644]
testsuite/tests/ghc-api/annotations/Test12417.hs [new file with mode: 0644]
testsuite/tests/ghc-api/annotations/all.T