Opened 9 years ago

Closed 3 years ago

#3003 closed bug (invalid)

Happy does not reject pragmas

Reported by: SamB Owned by:
Priority: lowest Milestone: 7.10.1
Component: Build System Version: 6.10.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

I was about to report a bug in GHC's handling of -fno-warn-missing signatures in pragmas, but wasn't able to reproduce it. Then I noticed it: the problem was that the pragma was at the very top of a .y file, where it was simply discarded, like this:

{-# OPTIONS_GHC -fno-warn-missing-signatures #-} {- -*- Haskell -*- -}

{

Happy should probably not just silently discard pragmas.

Change History (10)

comment:1 Changed 9 years ago by igloo

difficulty: Unknown
Milestone: 6.12 branch

comment:2 Changed 7 years ago by igloo

Milestone: 6.12 branch6.12.3

comment:3 Changed 7 years ago by igloo

Milestone: 6.12.36.14.1
Priority: normallow

comment:4 Changed 7 years ago by igloo

Milestone: 7.0.17.0.2

comment:5 Changed 7 years ago by igloo

Milestone: 7.0.27.2.1

comment:6 Changed 6 years ago by igloo

Milestone: 7.2.17.4.1

comment:7 Changed 6 years ago by igloo

Milestone: 7.4.17.6.1
Priority: lowlowest

comment:8 Changed 5 years ago by igloo

Milestone: 7.6.17.6.2

comment:9 Changed 3 years ago by thoughtpolice

Milestone: 7.6.27.10.1

Moving to 7.10.1.

comment:10 Changed 3 years ago by thomie

Resolution: invalid
Status: newclosed
Type of failure: None/Unknown

Thank you for your report. This doesn't seem like a GHC problem (anymore).

To make sure Happy doesn't treat the pragma as a comment (it doesn't know about pragmas, as you noticed), wrap it in an extra pair of curly braces, so that it is treated as a module header.

{{-# OPTIONS_GHC -fno-warn-missing-signatures #-}} {- -*- Haskell -*- -}
%tokentype { Token }
%%
doc : {  }

If you're still having problems with happy, please reraise it at the Happy issue tracker: https://github.com/simonmar/happy/issues.

Note: See TracTickets for help on using tickets.