Possible error with strict_mark in Parser.y

Jan Stolarek jan.stolarek at p.lodz.pl
Mon Dec 1 09:45:11 UTC 2014


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





More information about the ghc-devs mailing list