-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Catch unimplementedFeatureError
s and report them as errors
#15168
Conversation
0ae72b2
to
fd86f5b
Compare
345b55e
to
2e99c16
Compare
solUnimplementedFeatureError
s and report them as errorsunimplementedFeatureError
s and report them as errors
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.
That one was really tough to review. Not because of what the PR itself does but because the way error handling is done in the compiler is just too messy, inconsistent and slightly wrong in many annoying ways. I had a really hard time giving suggestions here on how to do it properly without just saying to rewrite it all :)
In any case, this needs some changes, but the fundamental approach is good. I like the idea of making parse()
, analyze()
and compile()
responsible for catching unimplemented feature errors rather than doing it outside.
I'd actually move even more handlers in there (e.g. YulException
and CompilerError
should IMO be handled inside compile()
), but that's out of the scope of the PR so let's not do that here. But overall, I think that all exceptions that are considered a normal part of the compiler operation and are not a result of a bug should be handled inside the respective "stack" class. Everything else that escapes should then just bubble up to the top-level handler.
559e027
to
ac7c9e2
Compare
44750e3
to
a68961d
Compare
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.
Still a few things to clean up.
reportUnimplementedFeatureError(_error); | ||
} | ||
|
||
if (m_errorReporter.errors().empty()) |
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.
if (m_errorReporter.errors().empty()) | |
if (!m_errorReporter.hasErrors()) |
Oh, this is actually a minor bug (not in the PR - it was here already). Checking errors().empty()
will count warnings and infos as errors, which is wrong - those should not fail compilatiohn. Turns out we don't have any warnings in Yul parser though, which is probably why it went unnoticed, but we should fix it nevertheless.
I see there are overall 16 uses of errors().empty()
in the codebase and some of them might be intended but some look like bugs. Maybe it would be better to fix them in a separate PR. At least this one had no user-visible effects (and the fix does not require a changelog entry) but others might have.
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.
Fixed.
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.
This is something you should at least put in a separate commit with its own description. It shouldn't be mixed in with other, unrelated changes, especially in a refactor like this. Like I said, I'd even go as far as to leave it as is here and only fix it in a separate PR along with the other instances.
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.
Ah right, I was thinking about checking the other cases later in another PR. I removed this change and will leave it for this future PR.
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.
PR created.
Two more things:
|
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.
@cameel, I added a changelog and addressed your comments.
You should wrap YulStack::optimize() in a handler too.
It was already wrapped... or are you referring to YulStack::optimize(Object& _object, bool _isCreation)
? This latter one is private and only called by YulStack::optimize()
.
Ah, you're right! I completely forgot that we decided to do this in the top-level |
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.
There are two remaining things to resolve, but they're minor enough that I'm already approving the PR as a whole.
reportUnimplementedFeatureError(_error); | ||
} | ||
|
||
if (m_errorReporter.errors().empty()) |
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.
This is something you should at least put in a separate commit with its own description. It shouldn't be mixed in with other, unrelated changes, especially in a refactor like this. Like I said, I'd even go as far as to leave it as is here and only fix it in a separate PR along with the other instances.
97c9383
to
bb16848
Compare
@cameel, I addressed your last review and squashed the commits. |
First attempt on partially closing #15139.
This is focusing on making #15001 pass our CI tests and hopefully will serve as a base for future tasks of the issue mentioned before.