Skip to content
  • Alan Zimmerman's avatar
    Lexer: Alternate Layout Rule injects actual not virtual braces · c1cf2693
    Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
    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
    c1cf2693