Fix SMT Checker crash due to missing type information

This commit is contained in:
Mathias Baumann 2019-02-27 11:55:59 +01:00
parent f9d1c283b7
commit f782125463
3 changed files with 8 additions and 0 deletions

View File

@ -448,6 +448,9 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
)
m_errorReporter.typeError(_variable.location(), "Variables cannot be declared in interfaces.");
if (_variable.typeName())
_variable.typeName()->accept(*this);
// type is filled either by ReferencesResolver directly from the type name or by
// TypeChecker at the VariableDeclarationStatement level.
TypePointer varType = _variable.annotation().type;

View File

@ -695,6 +695,7 @@ void SMTChecker::visitFunctionIdentifier(Identifier const& _identifier)
void SMTChecker::endVisit(Literal const& _literal)
{
solAssert(_literal.annotation().type, "Expected type for AST node");
Type const& type = *_literal.annotation().type;
if (isNumber(type.category()))

View File

@ -3,6 +3,10 @@ contract C
{
// Used to crash because Literal had no type
int[3] d;
// Used to crash because Literal had no type
int[3*1] x;
}
// ----
// Warning: (92-100): Assertion checker does not yet support the type of this variable.
// Warning: (149-159): Assertion checker does not yet support the type of this variable.
// Warning: (153-156): Assertion checker does not yet implement this operator on non-integer types.