diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2011-06-20 17:06:13 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2011-06-20 17:06:13 +0100 |
commit | 2e2651da55f577db59f274b99a71d8a50bc7a961 (patch) | |
tree | 645932fa4f21733b1837d508b104a06de2782d6e /compiler/parser | |
parent | 3b545c4edfd4cf61ff6dc7af18fde26faf4d7c4b (diff) | |
parent | 089cc2928c8c0e8107448e62b29b6392a1abe30f (diff) | |
download | haskell-2e2651da55f577db59f274b99a71d8a50bc7a961.tar.gz |
Merge branch 'master' of http://darcs.haskell.org/ghc
Diffstat (limited to 'compiler/parser')
-rw-r--r-- | compiler/parser/Lexer.x | 5 | ||||
-rw-r--r-- | compiler/parser/Parser.y.pp | 10 | ||||
-rw-r--r-- | compiler/parser/RdrHsSyn.lhs | 2 |
3 files changed, 12 insertions, 5 deletions
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index 43a400471e..736ab0967b 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -661,7 +661,7 @@ reservedWordsFM = listToUFM $ ( "export", ITexport, bit ffiBit), ( "label", ITlabel, bit ffiBit), ( "dynamic", ITdynamic, bit ffiBit), - ( "safe", ITsafe, bit ffiBit), + ( "safe", ITsafe, bit ffiBit .|. bit safeHaskellBit), ( "threadsafe", ITthreadsafe, bit ffiBit), -- ToDo: remove ( "interruptible", ITinterruptible, bit ffiBit), ( "unsafe", ITunsafe, bit ffiBit), @@ -1807,6 +1807,8 @@ relaxedLayoutBit :: Int relaxedLayoutBit = 24 nondecreasingIndentationBit :: Int nondecreasingIndentationBit = 25 +safeHaskellBit :: Int +safeHaskellBit = 26 always :: Int -> Bool always _ = True @@ -1902,6 +1904,7 @@ mkPState flags buf loc = .|. alternativeLayoutRuleBit `setBitIf` xopt Opt_AlternativeLayoutRule flags .|. relaxedLayoutBit `setBitIf` xopt Opt_RelaxedLayout flags .|. nondecreasingIndentationBit `setBitIf` xopt Opt_NondecreasingIndentation flags + .|. safeHaskellBit `setBitIf` safeHaskellOn flags -- setBitIf :: Int -> Bool -> Int b `setBitIf` cond | cond = bit b diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp index b663ac2aba..bb82aaa2d1 100644 --- a/compiler/parser/Parser.y.pp +++ b/compiler/parser/Parser.y.pp @@ -500,13 +500,17 @@ importdecls :: { [LImportDecl RdrName] } | {- empty -} { [] } importdecl :: { LImportDecl RdrName } - : 'import' maybe_src optqualified maybe_pkg modid maybeas maybeimpspec - { L (comb4 $1 $5 $6 $7) (ImportDecl $5 $4 $2 $3 (unLoc $6) (unLoc $7)) } + : 'import' maybe_src maybe_safe optqualified maybe_pkg modid maybeas maybeimpspec + { L (comb4 $1 $6 $7 $8) (ImportDecl $6 $5 $2 $3 $4 (unLoc $7) (unLoc $8)) } maybe_src :: { IsBootInterface } : '{-# SOURCE' '#-}' { True } | {- empty -} { False } +maybe_safe :: { Bool } + : 'safe' { True } + | {- empty -} { False } + maybe_pkg :: { Maybe FastString } : STRING { Just (getSTRING $1) } | {- empty -} { Nothing } @@ -1241,7 +1245,7 @@ sigdecl :: { Located (OrdList (LHsDecl RdrName)) } {% do s <- checkValSig $1 $3 ; return (LL $ unitOL (LL $ SigD s)) } | var ',' sig_vars '::' sigtypedoc - { LL $ toOL [ LL $ SigD (TypeSig n $5) | n <- $1 : unLoc $3 ] } + { LL $ toOL [ LL $ SigD (TypeSig ($1 : unLoc $3) $5) ] } | infix prec ops { LL $ toOL [ LL $ SigD (FixSig (FixitySig n (Fixity $2 (unLoc $1)))) | n <- unLoc $3 ] } | '{-# INLINE' activation qvar '#-}' diff --git a/compiler/parser/RdrHsSyn.lhs b/compiler/parser/RdrHsSyn.lhs index a9433441e8..10274e1823 100644 --- a/compiler/parser/RdrHsSyn.lhs +++ b/compiler/parser/RdrHsSyn.lhs @@ -774,7 +774,7 @@ checkValSig -> P (Sig RdrName) checkValSig (L l (HsVar v)) ty | isUnqual v && not (isDataOcc (rdrNameOcc v)) - = return (TypeSig (L l v) ty) + = return (TypeSig [L l v] ty) checkValSig lhs@(L l _) ty = parseErrorSDoc l ((text "Invalid type signature:" <+> ppr lhs <+> text "::" <+> ppr ty) |