SrcSpan incorrect for non-alphanumeric VarPat
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}
(VarPat
(Unqual {OccName: .})))]
Then consider the following similar program.
foo (x) = 5
The parse is as follows.
(L {tests/examples/ArgPuncParens.hs:2:5-7}
(ParPat
(L {tests/examples/ArgPuncParens.hs:2:6}
(VarPat
(Unqual {OccName: x})))))]
Notice two differences.
- The first parse lacks a surrounding
ParPat
. - If the
ParPat
is deliberately omitted then the given location encompasses the surrounding parentheses which is not consistent with the second example whereVarPat
specifically refers tox
.