[commit: ghc] wip/T16188: Fix inverted position pragma flag in parser API (3fcf79a)

git at git.haskell.org git at git.haskell.org
Sun Feb 10 21:31:37 UTC 2019


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

On branch  : wip/T16188
Link       : http://ghc.haskell.org/trac/ghc/changeset/3fcf79a47138661bb01276a94e3b6d934ba92d4d/ghc

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

commit 3fcf79a47138661bb01276a94e3b6d934ba92d4d
Author: Alec Theriault <alec.theriault at gmail.com>
Date:   Mon Jan 28 22:11:08 2019 -0800

    Fix inverted position pragma flag in parser API
    
    The behviour of `lexTokenStream` around position pragma was
    accidentally inverted in 469fe6133646df5568c9486de2202124cb734242.
    This fixes that bug.
    
    This also unbreaks #16239.


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

3fcf79a47138661bb01276a94e3b6d934ba92d4d
 compiler/parser/Lexer.x | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index 8219390..1e27158 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -2900,7 +2900,7 @@ lexTokenStream :: StringBuffer -> RealSrcLoc -> DynFlags -> ParseResult [Located
 lexTokenStream buf loc dflags = unP go initState{ options = opts' }
     where dflags' = gopt_set (gopt_unset dflags Opt_Haddock) Opt_KeepRawTokenStream
           initState at PState{ options = opts } = mkPState dflags' buf loc
-          opts' = opts{ pExtsBitmap = xbit UsePosPragsBit .|. pExtsBitmap opts }
+          opts' = opts{ pExtsBitmap = complement (xbit UsePosPragsBit) .&. pExtsBitmap opts }
           go = do
             ltok <- lexer False return
             case ltok of



More information about the ghc-commits mailing list