Merge pull request #11239 from ethereum/event-without-emit

Fix missing error when events are used without an emit statement.
This commit is contained in:
chriseth 2021-04-12 11:10:32 +02:00 committed by GitHub
commit d350bac5c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -24,6 +24,7 @@ Bugfixes:
* SMTChecker: Fix false positive in contracts that cannot be deployed.
* SMTChecker: Fix internal error on public getter returning dynamic data on older EVM versions where these are not available.
* SMTChecker: Fix internal error on try-catch with function call in catch block.
* Type Checker: Fix missing error when events are used without an emit statement.
AST Changes:

View File

@ -0,0 +1,16 @@
contract test {
event SetFirstElem(uint indexed elem);
event SetSecondElem(uint indexed elem);
function setVal() external {
emit SetFirstElem(0);
}
function setValX() external {
// There was a missing error for this case.
// Whenever there was a proper invocation of events,
// the compiler assumed that all the subsequent invocations
// were proper.
SetFirstElem(1);
}
}
// ----
// TypeError 3132: (421-436): Event invocations have to be prefixed by "emit".