[GHC] #12002: Pragmas after a module declaration are ignored without warning.

#12002: Pragmas after a module declaration are ignored without warning. -------------------------------------+------------------------------------- Reporter: seanparsons | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Normally pragmas are placed above the module declaration like so: {{{#!hs {-# LANGUAGE OverloadedStrings #-} module Main where }}} However if the above 2 lines are flipped around like this: {{{#!hs module Main where {-# LANGUAGE OverloadedStrings #-} }}} Then the behaviour seen by a user is that equivalent to the pragma not being present, because it would appear GHC ignores the multi-line comment it looks like. For a novice (I'm not one but it just tripped me up) this would be incredibly baffling (it was for me), it would be nice to see a warning for this at the least. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12002 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12002: Pragmas after a module declaration are ignored without warning. -------------------------------------+------------------------------------- Reporter: seanparsons | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj):
this would be incredibly baffling (it was for me), it would be nice to see a warning for this at the least
I agree! Anyone want to offer a patch? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12002#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12002: Pragmas after a module declaration are ignored without warning. -------------------------------------+------------------------------------- Reporter: seanparsons | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: #2260 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * component: Compiler => Compiler (Parser) * related: => #2260 Comment: Also reported as #2260. igloo says:
That's a good idea, although sadly not quite as easy to implement right as you might imagine.
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12002#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12002: Pragmas after a module declaration are ignored without warning. -------------------------------------+------------------------------------- Reporter: seanparsons | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: #2260 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by harpocrates): Maybe things have changed since 10 years ago when the comment quoted in comment:2 was made, but this is now a two line change. I propose that GHC try to report an unrecognized pragma when meeting a header pragma outside of the header. That's one of the default warnings anyways. I'll be submitting a fix for this shortly. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12002#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12002: Pragmas after a module declaration are ignored without warning. -------------------------------------+------------------------------------- Reporter: seanparsons | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: #2260 #13918 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by AntC): * related: #2260 => #2260 #13918 Comment: See also #13918 and other tickets linked to it. I guess GHC treats a pragma in an unexpected place as just a comment `{-` which it is `-}`. (@vanto seems to have a small cottage industry going of reporting these.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12002#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12002: Pragmas after a module declaration are ignored without warning. -------------------------------------+------------------------------------- Reporter: seanparsons | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: #2260 #13918 | Differential Rev(s): #13921 | Wiki Page: | -------------------------------------+------------------------------------- Changes (by AntC): * related: #2260 #13918 => #2260 #13918 #13921 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12002#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12002: Pragmas after a module declaration are ignored without warning. -------------------------------------+------------------------------------- Reporter: seanparsons | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: #2260 #13918 | Differential Rev(s): #13921 | Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * failure: Other => Incorrect error/warning at compile-time Comment: Replying to [comment:3 harpocrates]:
I'll be submitting a fix for this shortly.
@harpocrates: did you manage to create that patch? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12002#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC