Opened 4 years ago

Closed 4 years ago

#10357 closed bug (fixed)

ApiAnnotations : pquals production adds AnnVbar in the wrong place

Reported by: alanz Owned by: alanz
Priority: normal Milestone: 7.10.2
Component: Compiler (Parser) Version: 7.10.1
Keywords: ApiAnnotations Cc: mpickering
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D869
Wiki Page:

Description

The Parser.y production for pquals is

pquals :: { Located [[LStmt RdrName (LHsExpr RdrName)]] }
    : squals '|' pquals
                     {% addAnnotation (gl $ last $ unLoc $1) AnnVbar (gl $2) >>
                        return (sLL $1 $> (reverse (unLoc $1) : unLoc $3)) }
    | squals         { L (getLoc $1) [reverse (unLoc $1)] }

The squals are returned in reverse order, so the AnnVbar should be attached to the head of the list, not the last.

Change History (4)

comment:1 Changed 4 years ago by alanz

Differential Rev(s): Phab:D869

comment:2 Changed 4 years ago by alanz

Status: newpatch

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

In fe38195eb783fc2f2f2d5ef50fb665b06fd15e82/ghc:

ApiAnnotations : pquals production adds AnnVbar in the wrong place

Summary:
The Parser.y production for pquals is

    pquals :: { Located [[LStmt RdrName (LHsExpr RdrName)]] }
        : squals '|' pquals
                         {% addAnnotation (gl $ last $ unLoc $1) AnnVbar (gl $2) >>
                            return (sLL $1 $> (reverse (unLoc $1) : unLoc $3)) }
        | squals         { L (getLoc $1) [reverse (unLoc $1)] }

The squals are returned in reverse order, so the AnnVbar should be
attached to the head of the list, not the last.

Test Plan: ./validate

Reviewers: hvr, austin

Reviewed By: austin

Subscribers: thomie, mpickering

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

GHC Trac Issues: #10357

comment:4 Changed 4 years ago by thoughtpolice

Resolution: fixed
Status: patchclosed

Merged to ghc-7.10.

Note: See TracTickets for help on using tickets.