[commit: ghc] wip/T16279: Lexer: Alternate Layout Rule injects actual not virtual braces (dc16e6f)

git at git.haskell.org git at git.haskell.org
Mon Feb 4 11:30:39 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T16279
Link       : http://ghc.haskell.org/trac/ghc/changeset/dc16e6fb4ea021ad18f1e1bf07f5bac791de64eb/ghc

>---------------------------------------------------------------

commit dc16e6fb4ea021ad18f1e1bf07f5bac791de64eb
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   Sun Feb 3 10:27:42 2019 +0200

    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.
    
    Test case (the existing T13087.hs)
    
        {-# LANGUAGE AlternativeLayoutRule #-}
        {-# LANGUAGE LambdaCase            #-}
    
        isOne :: Int -> Bool
        isOne = \case 1 -> True
                      _ -> False
    
        main = return ()
    
    Closes #16279


>---------------------------------------------------------------

dc16e6fb4ea021ad18f1e1bf07f5bac791de64eb
 compiler/parser/Lexer.x                            | 28 ++++++++++----------
 testsuite/tests/ghc-api/annotations/Makefile       |  4 +++
 testsuite/tests/ghc-api/annotations/T16279.stdout  | 30 ++++++++++++++++++++++
 .../T13087.hs => ghc-api/annotations/Test16279.hs} |  2 ++
 testsuite/tests/ghc-api/annotations/all.T          |  7 ++---
 5 files changed, 54 insertions(+), 17 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc dc16e6fb4ea021ad18f1e1bf07f5bac791de64eb


More information about the ghc-commits mailing list