-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to turn warnings into errors #398
Conversation
Looks like the failures are due to the expect tests expecting exact line numbers in the backtraces. |
This error message is very bad anyway, I wanted feedback before changing it. |
This looks fine. We can refactor it later, either passing a warning accumulator, or converting to monadic style. How are you invoking odoc with The test should be fixed to pass, which I guess will happen when you fix up the error message :) |
For Compile, Html_fragment and Odoc_html
The option is added to |
What I meant is, how are you driving odoc? I am just curious for comparison. AFAIK when driving odoc through Dune, users still won't have easy access to the option.
The refactor looks okay at first glance, it is at least more consistent than what we had before :) I would accept a second PR for this. However, a lot of this code is probably in need of even more fundamental refactoring with respect to error propagation and reporting. |
My first thought was that is Dune's job. Just like libraries,
I'd like to split this in an other PR and go a little bit further to make things a little cleaner. |
Ok, that all sounds good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this PR ready for merge? It looks good to me.
Sorry for the delay and thanks for merging :) |
Yes, please :) |
CHANGES: Additions - Add option to turn warnings into errors (ocaml/odoc#398, Jules Aguillon) Bugs fixed - Emit quote before identifier in alias type expr (Fixes ocaml/odoc#391, Anton Bachin) - Handle generalized open statements introduced in 4.08 (ocaml/odoc#393, Jon Ludlam) - Refactor error reporting to avoid exiting the program in library code (ocaml/odoc#400, Jules Aguillon) - Build on OCaml 4.10 (ocaml/odoc#408, Jon Ludlam)
CHANGES: Additions - Add option to turn warnings into errors (ocaml/odoc#398, Jules Aguillon) Bugs fixed - Emit quote before identifier in alias type expr (Fixes ocaml/odoc#391, Anton Bachin) - Handle generalized open statements introduced in 4.08 (ocaml/odoc#393, Jon Ludlam) - Refactor error reporting to avoid exiting the program in library code (ocaml/odoc#400, Jules Aguillon) - Build on OCaml 4.10 (ocaml/odoc#408, Jon Ludlam)
Closes #284
This PR adds the option
--warn-error
to turn warnings into errors.It is implemented using a global flag and failing after warnings are printed.
This is the easier implementation I found and it has some problems:
shed_warnings
is called and the error is raised.I also started looking into other ways that require refactoring:
It's how the parser works but makes the code very verbose and introduce a lot of diffs. (~300 adds)
Error.catch
to also "catch" warningsThis is also a lot of changes and requires to change the API of
Error
to avoid bad uses, which requires even more refactoring.What do you think?