[GHC] #16279: Lexer: Alternate Layout Rule injects actual not virtual braces

GHC ghc-devs at haskell.org
Mon Mar 4 18:51:01 UTC 2019


#16279: Lexer: Alternate Layout Rule injects actual not virtual braces
-------------------------------------+-------------------------------------
        Reporter:  alanz             |                Owner:  alanz
            Type:  bug               |               Status:  merge
        Priority:  normal            |            Milestone:  8.8.1
       Component:  Compiler          |              Version:  8.6.3
  (Parser)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect API     |  Unknown/Multiple
  annotation                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #13807            |  Differential Rev(s):
       Wiki Page:                    |  https://gitlab.haskell.org/ghc/ghc/merge_requests/284
-------------------------------------+-------------------------------------

Comment (by Marge Bot <ben+marge-bot@…>):

 In [changeset:"c1cf2693d6efddeeeb813cd8995a1be136800d17/ghc"
 c1cf2693/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="c1cf2693d6efddeeeb813cd8995a1be136800d17"
 Lexer: Alternate Layout Rule injects actual not virtual braces

 When the alternate layout rule is activated via a pragma, it injects
 tokens for { and } to make sure that the source is parsed properly.

 But it injects ITocurly and ITccurly, rather than their virtual
 counterparts ITvocurly and ITvccurly.

 This causes problems for ghc-exactprint, which tries to print these.

 Likewise, any injected ITsemi should have a zero-width SrcSpan.

 Test case (the existing T13087.hs)

     {-# LANGUAGE AlternativeLayoutRule #-}
     {-# LANGUAGE LambdaCase            #-}

     isOne :: Int -> Bool
     isOne = \case 1 -> True
                   _ -> False

     main = return ()

 Closes #16279
 }}}

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


More information about the ghc-tickets mailing list