[commit: ghc] wip/ghc-8.8-az: Lexer: Alternate Layout Rule injects actual not virtual braces (f6abc30)

git at git.haskell.org git at git.haskell.org
Thu Feb 28 02:14:27 UTC 2019


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

On branch  : wip/ghc-8.8-az
Link       : http://ghc.haskell.org/trac/ghc/changeset/f6abc30dbac109f514e469ddfdffc7d2e3c95811/ghc

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

commit f6abc30dbac109f514e469ddfdffc7d2e3c95811
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.
    
    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
    
    (cherry picked from commit c1cf2693d6efddeeeb813cd8995a1be136800d17)
    (cherry picked from commit e0375ba980fd5639d23a29575efb00c30d97c743)


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

f6abc30dbac109f514e469ddfdffc7d2e3c95811
 compiler/parser/Lexer.x                            | 32 ++++++++++++----------
 testsuite/tests/ghc-api/annotations/Makefile       | 20 ++++++++++++++
 testsuite/tests/ghc-api/annotations/T16279.stdout  | 30 ++++++++++++++++++++
 .../T13087.hs => ghc-api/annotations/Test16279.hs} |  2 ++
 testsuite/tests/ghc-api/annotations/all.T          |  2 ++
 5 files changed, 71 insertions(+), 15 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 f6abc30dbac109f514e469ddfdffc7d2e3c95811


More information about the ghc-commits mailing list