[commit: ghc] wip/T15449, wip/T16188, wip/llvm-configure-opts: Lexer: Alternate Layout Rule injects actual not virtual braces (c1cf269)

git at git.haskell.org git at git.haskell.org
Sun Feb 10 21:30:33 UTC 2019


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

On branches: wip/T15449,wip/T16188,wip/llvm-configure-opts
Link       : http://ghc.haskell.org/trac/ghc/changeset/c1cf2693d6efddeeeb813cd8995a1be136800d17/ghc

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

commit c1cf2693d6efddeeeb813cd8995a1be136800d17
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


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

c1cf2693d6efddeeeb813cd8995a1be136800d17
 compiler/parser/Lexer.x                            | 32 ++++++++++++----------
 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          |  2 ++
 5 files changed, 55 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 c1cf2693d6efddeeeb813cd8995a1be136800d17


More information about the ghc-commits mailing list