From 2e1067a05ac5ab672f56fc51abac0d28a61195ff Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Fri, 17 Jul 2020 10:49:36 +0200 Subject: [PATCH] Set type properly for event parameters --- Changelog.md | 1 + libsolidity/analysis/TypeChecker.cpp | 2 +- .../smtCheckerTests/types/event_with_rational_size_array.sol | 2 ++ .../syntaxTests/types/event_with_rational_size_array.sol | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 test/libsolidity/smtCheckerTests/types/event_with_rational_size_array.sol create mode 100644 test/libsolidity/syntaxTests/types/event_with_rational_size_array.sol diff --git a/Changelog.md b/Changelog.md index 46c02667e..e0987a919 100644 --- a/Changelog.md +++ b/Changelog.md @@ -11,6 +11,7 @@ Compiler Features: Bugfixes: * SMTChecker: Fix internal error when using bitwise operators on fixed bytes type. * SMTChecker: Fix internal error when using compound bitwise operator assignments on array indices inside branches. + * SMTChecker: Fix error in events with indices of type static array. * Type Checker: Fix overload resolution in combination with ``{value: ...}``. * Type Checker: Fix internal compiler error related to oversized types. * Code Generator: Avoid double cleanup when copying to memory. diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 94d9544df..a81520b05 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -664,7 +664,7 @@ bool TypeChecker::visit(EventDefinition const& _eventDef) m_errorReporter.typeError(8598_error, _eventDef.location(), "More than 4 indexed arguments for anonymous event."); else if (!_eventDef.isAnonymous() && numIndexed > 3) m_errorReporter.typeError(7249_error, _eventDef.location(), "More than 3 indexed arguments for event."); - return false; + return true; } void TypeChecker::endVisit(FunctionTypeName const& _funType) diff --git a/test/libsolidity/smtCheckerTests/types/event_with_rational_size_array.sol b/test/libsolidity/smtCheckerTests/types/event_with_rational_size_array.sol new file mode 100644 index 000000000..98dfcec33 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/event_with_rational_size_array.sol @@ -0,0 +1,2 @@ +pragma experimental SMTChecker; +contract a { event b(uint[(1 / 1)]); } diff --git a/test/libsolidity/syntaxTests/types/event_with_rational_size_array.sol b/test/libsolidity/syntaxTests/types/event_with_rational_size_array.sol new file mode 100644 index 000000000..d0846345a --- /dev/null +++ b/test/libsolidity/syntaxTests/types/event_with_rational_size_array.sol @@ -0,0 +1 @@ +contract a { event b(uint[(1 / 1)]); }