-
Notifications
You must be signed in to change notification settings - Fork 122
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
Pretty manifest compiler error reporting #1741
Merged
lrubasze
merged 105 commits into
develop
from
feature/manifest_compiler_error_reporting
Mar 22, 2024
Merged
Pretty manifest compiler error reporting #1741
lrubasze
merged 105 commits into
develop
from
feature/manifest_compiler_error_reporting
Mar 22, 2024
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
dhedey
reviewed
Mar 20, 2024
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.
Really nice work! This is looking great. I love the attention to detail and clear error messages.
Most of my comments are minor suggestions/nitpicks, though there are one or two bugs that could be fixed too.
dhedey
approved these changes
Mar 21, 2024
iamyulong
approved these changes
Mar 22, 2024
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.
Summary
This PR adds pretty compiler error reports for more clarity.
Examples:
or
Details
Chosen annotate-snippets crate to pretty print faulty manifest snippets.
There are also some other libs, but they are not maintained or are not widely adopted.
This crate is used by
cargo
, which was decisive argument to pick it up.Each of the compiler errors:
LexerError
,ParserError
,GeneratorError
has its own error diagnostic function, which:More ideas:
invalid Ident specified 'CALL_METHODS', maybe you ment: 'CALL_METHOD'
AddressBech32DecodeError
orParseNonFungibleLocalIdError
instead of generic error message such as:
error: invalid global address 'some_address'
we could print:
error: expected value of type String, found Bytes (alias of Array)
instead of:
error: expected value of type String, found Array
Testing
Respective tests added.
Each test consist of 2 files:
*.rtm
manifest file with some error*.diag
file with expected compiler outputThese files don't look good in Github, the best is to inspect them with
cat
command in terminal.Others use
*.svg
files, but I thought it's better to keep it simple.Update Recommendations
For dApp Developers
Enjoy beautiful compiler error reports 🥂
For Internal Integrators
Maybe worth integrating with anything that uses raw manifest
*.rtm
files