Skip to content

Parser.y: clarify treatment of @{-# UNPACK #-}

Vladislav Zavialov requested to merge wip/no-at-unpack into master

Before this patch, we had this parser production:

ftype : ...
      | ftype PREFIX_AT tyarg  { ... }

And tyarg is defined as follows:

tyarg : atype              { ... }
      | unpackedness atype { ... }

So one might get the (false) impression that that parser production is intended to parse things like:

F @{-# UNPACK #-} X

However, the lexer wouldn't produce PREFIX_AT followed by unpackedness, as the @ operator followed by {- is not considered prefix.

Thus there's no point using tyarg after PREFIX_AT, and a simple atype will suffice:

ftype : ...
      | ftype PREFIX_AT atype  { ... }

This change has no user-facing consequences. It just makes the grammar a bit more clear.

Merge request reports