-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Recommended use of 'emit' invalid inside tuples #3887
Comments
Oh wow, someone found an edge case in the parser :) Did you use an automated tool for that? The thing is that I would actually say that the specific code you gave should be invalid even with the old rules, since you create a tuple with a component that has a null type (events do not return anything). |
Yeah, this is how we've been instrumenting ternary statements in solidity-coverage, because it was the only way to use the comma 'operator'.
Does this mean this could be expected to start working again in 0.5.0? (Assuming that you don't nix tuples with components with null types... it sounds like I may have shot myself in the foot!) |
it might work with 0.5.0, but let me actually check, this bug might lie deeper than just what is visible with emit. |
Yes, this should also be an error:
|
In general, it should not be possible to use events outside of the statement level. #3889 should get us closer there. |
Oh I'm sorry, now I only understand that this breaks your functionality. |
I guess you have to translate ternary statements even more into proper if statements. |
That's fine. For the greater good!
Yeah, I'm pretty sure this is where we're going to have to go now. Thanks for being so responsive. |
Solidity 0.4.21 provides a warning when not using
emit
with events:However, inserting
emit
causes compilation to fail with:ParserError: Expected token Comma got 'Identifier' (x) ? ( emit __SomeEvent(), y=false) : (emit __SomeEvent(), y = false);
Was this use never really supported? Or was this regression an oversight when
emit
was introduced? I could certainly believe either scenario!The text was updated successfully, but these errors were encountered: