mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2635 from ethereum/fixCrashOnAssignmentToNonLValue
Fix crash on assignment to non-LValue
This commit is contained in:
commit
53f747b7de
@ -12,6 +12,7 @@ Features:
|
||||
* Type checker: Warn when existing symbols, including builtins, are overwritten.
|
||||
|
||||
Bugfixes:
|
||||
* Type Checker: Fix crash for some assignment to non-lvalue.
|
||||
* Type Checker: Fix invalid "specify storage keyword" warning for reference members of structs.
|
||||
* Type Checker: Mark modifiers as internal.
|
||||
* Type Checker: Re-allow multiple mentions of the same modifier per function.
|
||||
|
@ -1122,7 +1122,9 @@ bool TypeChecker::visit(Assignment const& _assignment)
|
||||
_assignment.annotation().type = make_shared<TupleType>();
|
||||
expectType(_assignment.rightHandSide(), *tupleType);
|
||||
|
||||
checkDoubleStorageAssignment(_assignment);
|
||||
// expectType does not cause fatal errors, so we have to check again here.
|
||||
if (dynamic_cast<TupleType const*>(type(_assignment.rightHandSide()).get()))
|
||||
checkDoubleStorageAssignment(_assignment);
|
||||
}
|
||||
else if (t->category() == Type::Category::Mapping)
|
||||
{
|
||||
|
@ -6437,6 +6437,20 @@ BOOST_AUTO_TEST_CASE(using_this_in_constructor)
|
||||
CHECK_WARNING(text, "\"this\" used in constructor");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(do_not_crash_on_not_lalue)
|
||||
{
|
||||
// This checks for a bug that caused a crash because of continued analysis.
|
||||
char const* text = R"(
|
||||
contract C {
|
||||
mapping (uint => uint) m;
|
||||
function f() {
|
||||
m(1) = 2;
|
||||
}
|
||||
}
|
||||
)";
|
||||
CHECK_ERROR_ALLOW_MULTI(text, TypeError, "is not callable");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user