-
Notifications
You must be signed in to change notification settings - Fork 148
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
Diagnostics #78
Open
drslump
wants to merge
21
commits into
boo-lang:master
Choose a base branch
from
drslump:diagnostics
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Diagnostics #78
Conversation
This file contains 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
I think this is a very good idea. I'll be reviewing the code soon. |
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.
Just for initial review, not ready for merge yet.
These changes follow my previous proposal.
While the current system to handle errors in the compiler is pretty good I think we could benefit from adopting the one used by clang. The basic idea is to keep all the diagnostics under an unified interface, delaying their resolution until the moment we want to notify them to the consumer, be it the command line compiler or an IDE addon.
I've tried to keep the previous API (
Context.Errors
andContext.Warnings
) working, as well as flagging as obsolete the modified parameter and command line options. This should ensure that other software building upon the Boo compiler infrastructure keeps working without modifications. This approach of allowing both kinds of error reporting to co-exists should make it possible to include this soon in the master branch and keep iterating to improve more and more errors over time.Note that now errors, warnings and notes are all modelled as a diagnostic. They all share the same code namespace. I'm numbering errors from 1-1000, warnings from 1001-2000 and notes from 2001-3000. The idea is that when extending the compiler, extenders can take an unused range for their custom diagnostics. Besides that, they are not visible (unless verbosity is enabled), humans don't usually remember well so many different numbers 🐘
I will need some feedback about the overall direction of the change, no sense in pushing this forward if it's not going to be included at the end. Also some guidance on where to define the diagnostics, separating the message format, from the factory and the application point has its merits but seems a bit tedious IMHO. I would like to try defining them in place with some small helpers for code reuse.
Here is an example of the new reporting (with colors is really much better):
This one shows a "fix-it" hint (which could be automated when integrated in an editor addin):
And this is how it applies to errors not yet ported: