diff options
author | simonpj <unknown> | 2004-12-23 11:50:57 +0000 |
---|---|---|
committer | simonpj <unknown> | 2004-12-23 11:50:57 +0000 |
commit | c97ea0ce7025c0fc56b02b171843ed50c00ef75d (patch) | |
tree | ecc067ffb98980077a2569eb9c6e9c064713fe93 /ghc/compiler/parser/Lexer.x | |
parent | e12e0bb72881bd814f449e27b6d870646997864f (diff) | |
download | haskell-c97ea0ce7025c0fc56b02b171843ed50c00ef75d.tar.gz |
[project @ 2004-12-23 11:50:55 by simonpj]
Enable scoped type variables only where there is an explicit forall
Diffstat (limited to 'ghc/compiler/parser/Lexer.x')
-rw-r--r-- | ghc/compiler/parser/Lexer.x | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ghc/compiler/parser/Lexer.x b/ghc/compiler/parser/Lexer.x index 1d0a5e7bce..0a2f3c5e23 100644 --- a/ghc/compiler/parser/Lexer.x +++ b/ghc/compiler/parser/Lexer.x @@ -506,7 +506,7 @@ reservedWordsFM = listToUFM $ ( "where", ITwhere, 0 ), ( "_scc_", ITscc, 0 ), -- ToDo: remove - ( "forall", ITforall, bit glaExtsBit), + ( "forall", ITforall, bit tvBit), ( "mdo", ITmdo, bit glaExtsBit), ( "foreign", ITforeign, bit ffiBit), @@ -542,7 +542,7 @@ reservedSymsFM = listToUFM $ ,("!", ITbang, 0) ,("*", ITstar, bit glaExtsBit) -- For data T (a::*) = MkT - ,(".", ITdot, bit glaExtsBit) -- For 'forall a . t' + ,(".", ITdot, bit tvBit) -- For 'forall a . t' ,("-<", ITlarrowtail, bit arrowsBit) ,(">-", ITrarrowtail, bit arrowsBit) @@ -1160,6 +1160,7 @@ parrBit = 2 arrowsBit = 4 thBit = 5 ipBit = 6 +tvBit = 7 -- Scoped type variables enables 'forall' keyword glaExtsEnabled, ffiEnabled, parrEnabled :: Int -> Bool glaExtsEnabled flags = testBit flags glaExtsBit @@ -1168,6 +1169,7 @@ parrEnabled flags = testBit flags parrBit arrowsEnabled flags = testBit flags arrowsBit thEnabled flags = testBit flags thBit ipEnabled flags = testBit flags ipBit +tvEnabled flags = testBit flags tvBit -- create a parse state -- @@ -1190,6 +1192,7 @@ mkPState buf loc flags = .|. arrowsBit `setBitIf` dopt Opt_Arrows flags .|. thBit `setBitIf` dopt Opt_TH flags .|. ipBit `setBitIf` dopt Opt_ImplicitParams flags + .|. tvBit `setBitIf` dopt Opt_ScopedTypeVariables flags -- setBitIf :: Int -> Bool -> Int b `setBitIf` cond | cond = bit b |