Fix bug in constant evaluator.

This commit is contained in:
chriseth
2020-12-09 15:50:53 +01:00
parent fca8026250
commit 251f2a4d93
3 changed files with 10 additions and 1 deletions
+2 -1
View File
@@ -271,7 +271,8 @@ optional<TypedRational> ConstantEvaluator::evaluate(ASTNode const& _node)
if (auto const* varDecl = dynamic_cast<VariableDeclaration const*>(&_node))
{
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;
else
{