[GHC] #10243: SrcSpan incorrect for non-alphanumeric VarPat

GHC ghc-devs at haskell.org
Sun Apr 5 10:42:22 UTC 2015


#10243: SrcSpan incorrect for non-alphanumeric VarPat
-------------------------------------+-------------------------------------
              Reporter:  mpickering  |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:  7.10.2
             Component:  Compiler    |           Version:  7.10.1
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |        Blocked By:
             Test Case:              |   Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 There is an inconsistency when parsing patterns which contain non-
 alphanumeric characters.

 For example,

 {{{!#hs
 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.

 {{{#!hs
 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.

 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`.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10243>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list