mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10542 from ethereum/fixConstantEv
Fix bug in constant evaluator.
This commit is contained in:
commit
32f1f16b8a
@ -271,7 +271,8 @@ optional<TypedRational> ConstantEvaluator::evaluate(ASTNode const& _node)
|
|||||||
if (auto const* varDecl = dynamic_cast<VariableDeclaration const*>(&_node))
|
if (auto const* varDecl = dynamic_cast<VariableDeclaration const*>(&_node))
|
||||||
{
|
{
|
||||||
solAssert(varDecl->isConstant(), "");
|
solAssert(varDecl->isConstant(), "");
|
||||||
if (!varDecl->value())
|
// In some circumstances, we do not yet have a type for the variable.
|
||||||
|
if (!varDecl->value() || !varDecl->type())
|
||||||
m_values[&_node] = nullopt;
|
m_values[&_node] = nullopt;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
int[L] constant L = 6;
|
||||||
|
// ----
|
||||||
|
// TypeError 5462: (4-5): Invalid array length, expected integer literal or constant expression.
|
@ -0,0 +1,5 @@
|
|||||||
|
contract C {
|
||||||
|
int[L] constant L = 6;
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// TypeError 5462: (21-22): Invalid array length, expected integer literal or constant expression.
|
Loading…
Reference in New Issue
Block a user