Opened 5 years ago

Closed 5 years ago

#10243 closed bug (invalid)

SrcSpan incorrect for non-alphanumeric VarPat

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

Description (last modified by mpickering)

There is an inconsistency when parsing patterns which contain non-alphanumeric characters.

For example,

foo (.) = 5

the pattern parses as the following.

 (L {tests/examples/ArgPuncParens.hs:2:5-7}
    (Unqual {OccName: .})))]

Then consider the following similar program.

foo (x) = 5

The parse is as follows.

  (L {tests/examples/ArgPuncParens.hs:2:5-7}
      (L {tests/examples/ArgPuncParens.hs:2:6}
          (Unqual {OccName: x})))))]

Notice two differences.

  1. The first parse lacks a surrounding ParPat.
  2. If the ParPat is deliberately omitted then the given location encompasses the surrounding parentheses which is not consistent with the second example where VarPat specifically refers to x.

Change History (2)

comment:1 Changed 5 years ago by mpickering

Description: modified (diff)

comment:2 Changed 5 years ago by rwbarton

Resolution: invalid
Status: newclosed

These really do parse differently though: (x) is a pattern x enclosed in parentheses, while (.) is a single identifier (infix operator in prefix form).

If you consult I think you will find that these outputs match the parses specified by the Report. Please reopen if you disagree.

Note: See TracTickets for help on using tickets.