[GHC] #10106: GHC doesn't warn on typos in language pragmas

#10106: GHC doesn't warn on typos in language pragmas -------------------------------------+------------------------------------- Reporter: sdemos | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.4 Keywords: | Operating System: Linux Architecture: | Type of failure: Incorrect Unknown/Multiple | warning at compile-time Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- In particular, I was struggling with the QuasiQuotes language extension. I had - {{{#!hs {-# LANGAUGE QuasiQuotes #-} site = [shamelet|Hello World!|] }}} Notice the transposed A and U in `LANGUAGE` The error that ghc was emitting was - `Main.hs:23:47: parse error on input ‘]’` It took me a long time and a lot of head-banging to figure out that it was a typo in the language pragma, especially because the language pragma was surrounded by other language pragmas and it was at the top of the file. I would think that this should at least emit a warning when there is a typo in a pragma. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10106 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10106: GHC doesn't warn on typos in language pragmas -------------------------------------+------------------------------------- Reporter: sdemos | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.4 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Incorrect | (amd64) warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by sdemos): * architecture: Unknown/Multiple => x86_64 (amd64) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10106#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10106: GHC doesn't warn on typos in language pragmas -------------------------------------+------------------------------------- Reporter: sdemos | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.4 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Incorrect | (amd64) warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by hvr): The problem is rather that the warning is suppressed if errors exist... if you comment out the quasiquote use site, you'd get a `Warning: Unrecognised pragma` -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10106#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10106: GHC doesn't warn on typos in language pragmas -------------------------------------+------------------------------------- Reporter: sdemos | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.4 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Incorrect | (amd64) warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by sdemos): I tested that out with my code, and it does indeed print out the `Warning: Unrecognized pragma` warning. However, I think it would be better for debugging this type of issue if it didn't suppress the warning, or gave a hint that the unrecognized pragma might be the issue. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10106#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10106: GHC doesn't warn on typos in language pragmas -------------------------------------+------------------------------------- Reporter: sdemos | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.4 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Incorrect | (amd64) warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: #10076 | Differential Revisions: -------------------------------------+------------------------------------- Changes (by jstolarek): * related: => #10076 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10106#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10106: GHC doesn't warn on typos in language pragmas -------------------------------------+------------------------------------- Reporter: sdemos | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.4 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Incorrect | (amd64) warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: #10076 | Differential Revisions: -------------------------------------+------------------------------------- Comment (by simonpj): The underlying issue here is: * A "warning" differs from an "error", in that only the latter halt compilation (unless you use `-Werror`. * We do not display warnings if there are any errors, to draw attention to the errors. Maybe we need some kind of in-between thing, say a "prominent warning". It is like a warning in that it does not halt compilation. But it is not suppressed by errors. Then a mis-spelled pragma could be a "prominent warning". Bizarrely, we currently have no fewer than '''seven''' levels of severity for output messages: {{{ data Severity = SevOutput | SevDump | SevInteractive | SevInfo | SevWarning | SevError | SevFatal }}} (in `Error.hs`). The intended semantics of these levels is entirely undocumented, and I have no clue what they mean. I would love this to documented; probably we can nuke several levels. But adding `SevProminentWarning` (properly documented) would arguably do little harm. But someone would have to want to do it. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10106#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10106: GHC doesn't warn on typos in language pragmas -------------------------------------+------------------------------------- Reporter: sdemos | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.4 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Incorrect | (amd64) warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: #10076 | Differential Revisions: -------------------------------------+------------------------------------- Comment (by jstolarek):
Maybe we need some kind of in-between thing, say a "prominent warning". It is like a warning in that it does not halt compilation. But it is not suppressed by errors. Then a mis-spelled pragma could be a "prominent warning".
Somehow I don't like that idea. Seems to complicate things even more. #10076 also gives an example where a warning should not be suppressed in the presence of errors. That would also have to become "prominent warning" and I believe that with time we would discover more such cases, all of which would have to be turned into "prominent warnings". The idea of simply not suppressing warnings in the presence of errors seems to be a better solution, unless I'm missing something? But I agree that these seven levels of severity should be cleaned. Ideally - looking at packages like `log4j` for Java - the whole tracing mechanism should be integrated into one with error and warning reporting mechanism but that would be an enormous task and realistically I don't expect this to happen. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10106#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10106: GHC doesn't warn on typos in language pragmas -------------------------------------+------------------------------------- Reporter: sdemos | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.4 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Incorrect | (amd64) warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: #10076 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Lemming): Sometimes I (ab)use `-fdefer-type-errors` in order to see warnings along with errors. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10106#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC