Insert a blank line between consecutive compiler messages#12024
Insert a blank line between consecutive compiler messages#12024gasche merged 6 commits intoocaml:trunkfrom
Conversation
cd16d3d to
94836c9
Compare
|
The code change looks fine to me: it seems fine to have a function that is used to mark the start of separate user messages. I expect that if we move to a structured log for the compiler functions those function calls will be naturally subsumed by the more general API. |
|
This reads like an approving review, without the approval stamp. What's your thought on what this PR needs next? |
ab541a5 to
7a31d6d
Compare
|
I am reading the testsuite changes before giving my approval. |
| As you could guess, Deprecated_module is deprecated. | ||
| Please use something else! | ||
|
|
||
|
|
There was a problem hiding this comment.
The second blank line here comes for the deprecation message, which suggest that this PR might slightly affect the design of deprecation message.
| Use the equivalent signed form: -f-r-a-g-i-l-e-m-a-t-h. | ||
| Hint: Enabling or disabling a warning by its mnemonic name requires a + or - prefix. | ||
| Hint: Did you make a spelling mistake when using a mnemonic name? | ||
|
|
There was a problem hiding this comment.
This newline is from an empty toplevel phrase.
There was a problem hiding this comment.
Ah, I guess my move to a signature option should be changed back into "is the empty signature?" to account for other ways the signature could be empty. I will do this.
There was a problem hiding this comment.
I fixed this (now the toplevel-specific commit has a much shorter diff) and rebased. Thanks for the eagle eyes!
|
The regexp of ocamltex's |
7a31d6d to
b847d4b
Compare
Urgh, would you maybe be willing to do this part yourself? (You should have push rights on my fork.) |
|
The fix for ocamltex is available at Octachron/ocaml@5b8852a16979af60 . |
|
Thanks! I added it to the PR. |
e2b505b to
784f86a
Compare
|
There were some bits of testsuite changes left to promote, I did this and kept the fixup commits around for now for easier reviewing. |
Octachron
left a comment
There was a problem hiding this comment.
The testsuite is passing and adding some negative spaces to the compiler messages is a good idea.
784f86a to
fe953a7
Compare
This PR is inspired by user feedback from @mimoo on compiler error messages which originated in #11539.
Currently OCaml tools will include several messages concatenated together -- several warnings, possibly followed by one error -- and it may not be obvious especially for new users to visually split the output in several reports.
This PR introduces a blank line between consecutive reports.
(cc @Octachron)
Batch compiler example
Before:
After:
Toplevel example
Before:
After:
Implementation
Most of the logic is hidden in
Location, but unfortunately there are other places in the compiler that print user messages thanLocation.print_report, so we need to break the abstraction a bit and expose a function "I'm about to print a new message" to be called by other modules. Not super nice, but not too bad either -- and very short.Note
In the original report, the issue was at the build-system level (the build system would concatenate several errors coming from different files); I reported this issue on dune in ocaml/dune#6158 , and this is getting fixed by @esope in ocaml/dune#6823. The present PR is about messages concatenated by the compiler itself.