Possible error with strict_mark in Parser.y

If I look at the production for strict_mark in the parser https://github.com/ghc/ghc/blob/master/compiler/parser/Parser.y#L1355 strict_mark :: { Located ([AddAnn],HsBang) } : '!' { sL1 $1 ([],HsUserBang Nothing True) } | '{-# UNPACK' '#-}' { sLL $1 $> ([mo $1,mc $2],HsUserBang (Just True) False) } | '{-# NOUNPACK' '#-}' { sLL $1 $> ([mo $1,mc $2],HsUserBang (Just False) True) } -- ***Correct? | '{-# UNPACK' '#-}' '!' { sLL $1 $> ([mo $1,mc $2],HsUserBang (Just True) True) } | '{-# NOUNPACK' '#-}' '!' { sLL $1 $> ([mo $1,mc $2],HsUserBang (Just False) True) } I would expect the final True or False value to reflect the presence of the '!' mark. But the second line has no '!' but returns True. I suspect this is an error. Alan

Looking at the source code comments it seems that you're right: data HsBang = HsUserBang -- The user's source-code request (Maybe Bool) -- Just True {-# UNPACK #-} -- Just False {-# NOUNPACK #-} -- Nothing no pragma Bool -- True <=> '!' specified Can anyone confirm? Janek Dnia niedziela, 30 listopada 2014, Alan & Kim Zimmerman napisał:
If I look at the production for strict_mark in the parser
https://github.com/ghc/ghc/blob/master/compiler/parser/Parser.y#L1355
strict_mark :: { Located ([AddAnn],HsBang) }
: '!' { sL1 $1 ([],HsUserBang Nothing
True) }
| '{-# UNPACK' '#-}' { sLL $1 $> ([mo $1,mc $2],HsUserBang
(Just True) False) }
| '{-# NOUNPACK' '#-}' { sLL $1 $> ([mo $1,mc $2],HsUserBang
(Just False) True) } -- ***Correct?
| '{-# UNPACK' '#-}' '!' { sLL $1 $> ([mo $1,mc $2],HsUserBang
(Just True) True) }
| '{-# NOUNPACK' '#-}' '!' { sLL $1 $> ([mo $1,mc $2],HsUserBang
(Just False) True) }
I would expect the final True or False value to reflect the presence of the '!' mark.
But the second line has no '!' but returns True.
I suspect this is an error.
Alan

Thanks. It was totally wrong. I have fixed it. Simon | -----Original Message----- | From: ghc-devs [mailto:ghc-devs-bounces@haskell.org] On Behalf Of Jan | Stolarek | Sent: 01 December 2014 09:45 | To: ghc-devs@haskell.org | Subject: Re: Possible error with strict_mark in Parser.y | | Looking at the source code comments it seems that you're right: | | data HsBang | = HsUserBang -- The user's source-code request | (Maybe Bool) -- Just True {-# UNPACK #-} | -- Just False {-# NOUNPACK #-} | -- Nothing no pragma | Bool -- True <=> '!' specified | | | Can anyone confirm? | | Janek | | Dnia niedziela, 30 listopada 2014, Alan & Kim Zimmerman napisał: | > If I look at the production for strict_mark in the parser | > | > https://github.com/ghc/ghc/blob/master/compiler/parser/Parser.y#L1355 | > | > strict_mark :: { Located ([AddAnn],HsBang) } | > | > : '!' { sL1 $1 ([],HsUserBang Nothing | > | > True) } | > | > | '{-# UNPACK' '#-}' { sLL $1 $> ([mo $1,mc | $2],HsUserBang | > | > (Just True) False) } | > | > | '{-# NOUNPACK' '#-}' { sLL $1 $> ([mo $1,mc | $2],HsUserBang | > | > (Just False) True) } -- ***Correct? | > | > | '{-# UNPACK' '#-}' '!' { sLL $1 $> ([mo $1,mc | $2],HsUserBang | > | > (Just True) True) } | > | > | '{-# NOUNPACK' '#-}' '!' { sLL $1 $> ([mo $1,mc | $2],HsUserBang | > | > (Just False) True) } | > | > I would expect the final True or False value to reflect the presence of | the | > '!' mark. | > | > But the second line has no '!' but returns True. | > | > I suspect this is an error. | > | > Alan | | | | _______________________________________________ | ghc-devs mailing list | ghc-devs@haskell.org | http://www.haskell.org/mailman/listinfo/ghc-devs
participants (3)
-
Alan & Kim Zimmerman
-
Jan Stolarek
-
Simon Peyton Jones