Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#12417 closed bug (fixed)

API annotations for unboxed sums needs reworking

Reported by: osa1 Owned by: alanz
Priority: normal Milestone: 8.2.1
Component: Compiler (Parser) Version: 8.1
Keywords: UnboxedSums Cc: alanz
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect API annotation Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D2968
Wiki Page:

Description

API annotations for unboxed sums are not entirely correct. As far as I understand, some of the bars (|) in the concrete syntax are not properly attached to any of the AST nodes. Some discussion can be seen in the Phab page.

Change History (6)

comment:1 Changed 3 years ago by alanz

Component: CompilerCompiler (Parser)
Milestone: 8.2.1
Owner: set to alanz
Type of failure: None/UnknownIncorrect API annotation
Version: 8.0.18.1

comment:2 Changed 3 years ago by alanz

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 annotation perspective, the 5 AnnVbars after the b are attached to lexp, but currently the leading AnnVbars do not have a home.

They need to be attached to the parent tuple expression.

comment:3 Changed 3 years ago by alanz

Differential Rev(s): Phab:D2968
Status: newpatch

comment:4 Changed 3 years ago by Alan Zimmerman <alan.zimm@…>

In 38f289fa/ghc:

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

comment:5 Changed 3 years ago by alanz

Resolution: fixed
Status: patchclosed

comment:6 Changed 2 years ago by RyanGlScott

Keywords: UnboxedSums added
Note: See TracTickets for help on using tickets.