[GHC] #5682: Properly parse promoted data constructor operators

GHC ghc-devs at haskell.org
Tue Feb 18 03:48:09 UTC 2014


#5682: Properly parse promoted data constructor operators
-------------------------------------+-------------------------------------
        Reporter:  lunaris           |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:  7.8.1
       Component:  Compiler          |          Version:  7.8.1-rc1
  (Parser)                           |         Keywords:  PolyKinds, ghc-
      Resolution:                    |  kinds
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  GHC rejects       |       Difficulty:  Unknown
  valid program                      |       Blocked By:
       Test Case:                    |  Related Tickets:  #8486
  parser/should_compile/T5682        |
        Blocking:                    |
-------------------------------------+-------------------------------------
Changes (by guest):

 * status:  closed => new
 * resolution:  fixed =>


Comment:

 Promoted tuple constructors (e.g. `'(,,)`) still don't parse. This patch
 to `compiler/parser/Parser.y.pp` fixes it. With this patch, `'` can be
 used with any `qcon` so the redundant rules have been removed. Using an
 un-promotable data constructor will give a meaningful error message such
 as `Data constructor ‛(##)’ comes from an un-promotable type ‛(##)’`
 instead of a parse error.

 `'(' varop ')'` was changed to `var` because `'id` is more consistent than
 {{{'(`id`)}}} and `btype SIMPLEQUOTE varop  type` (in `type` and
 `typedoc`) allows backquoted identifiers as operators.

 {{{
 1154,1155c1154
 <         | SIMPLEQUOTE qconid                          { LL $ HsTyVar $
 unLoc $2 }
 <         | SIMPLEQUOTE  '(' ')'                        { LL $ HsTyVar $
 getRdrName unitDataCon }
 ---
 >         | SIMPLEQUOTE qcon                            { LL $ HsTyVar $
 unLoc $2 }
 1158,1159c1157
 <         | SIMPLEQUOTE '(' qconop ')'                  { LL $ HsTyVar
 (unLoc $3) }
 <         | SIMPLEQUOTE '(' varop  ')'                  { LL $ HsTyVar
 (unLoc $3) }
 ---
 >         | SIMPLEQUOTE var                             { LL $ HsTyVar $
 unLoc $2 }
 }}}

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


More information about the ghc-tickets mailing list