error messages: composable formatting for warnings - #13568
Merged
Merged
Conversation
goldfirere
approved these changes
Oct 30, 2024
goldfirere
left a comment
Contributor
There was a problem hiding this comment.
I did not review every error message change, but this looks reasonable overall; I don't think fine-grained review of messages is necessary here, trusting @Octachron to have examined examples of output changes as he implemented this.
| Format.pp_close_tbox () | ||
| ) () | ||
| in | ||
| let new_format self ppf report = |
Contributor
There was a problem hiding this comment.
Suggested change
| let new_format self ppf report = | |
| let warning_format self ppf report = |
Octachron
force-pushed
the
formatted_warnings
branch
from
November 5, 2024 14:58
d7c8fc2 to
3861f3b
Compare
Member
Author
Octachron
force-pushed
the
formatted_warnings
branch
from
November 18, 2024 17:04
2f2b62d to
cb3a4c4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enables composable formatting for warning messages.
Before this PR warning messages were rendered as strings before being sent to the error report printer.
Consequently, warning messages could not really use styling nor formatting hints in a reliable way.
This PR switches warning messages to render to
Format_doc.trather than string (like error messages) to enable both options.A painful source of complexity for this PR as described in #12965 is that the format used for error message reports
does not work well for warnings because the width of the header for warning is unbounded and often quite large.
To solve this formatting issue, this PR takes the alternative path of implementing a new format for warnings and alerts
while keeping the old format for error messages. I expect this to be a (temporarily?) work-around to decouple the formatting of warnings from the change of format for all error messages.