Opened 4 years ago

Closed 4 years ago

#10358 closed bug (fixed)

ApiAnnotations : PatBind gives wrong SrcSpan for the pattern.

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:D873
Wiki Page:

Description

The production for decl_no_th starts

decl_no_th :: { Located (OrdList (LHsDecl RdrName)) }
        : sigdecl               { $1 }

        | '!' aexp rhs          {% do { let { e = sLL $1 $> (SectionR (sL1 $1 (HsVar bang_RDR)) $2) };
                                        pat <- checkPattern empty e;
...

The e value should be just the pattern, excluding the rhs, but the span created includes the rhs.

Change History (4)

comment:1 Changed 4 years ago by alanz

Differential Rev(s): Phab:D873

comment:2 Changed 4 years ago by alanz

Status: newpatch

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

In ecc3d6be218b1c7a36ee3f2f36c4f3ac4f45c34f/ghc:

ApiAnnotations : PatBind gives wrong SrcSpan for the pattern.

Summary:
The production for decl_no_th starts

    decl_no_th :: { Located (OrdList (LHsDecl RdrName)) }
            : sigdecl               { $1 }

            | '!' aexp rhs  {% do { let { e = sLL $1 $> (SectionR (sL1 $1 (HsVar bang_RDR)) $2) };
                                    pat <- checkPattern empty e;
    ...

The e value should be just the pattern, excluding the rhs, but the span
created includes the rhs.

Test Plan: ./validate

Reviewers: hvr, austin

Reviewed By: austin

Subscribers: bgamari, thomie, mpickering

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

GHC Trac Issues: #10358

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.