Move assertion in PostTypeChecker's ConstStateVarCircularReferenceChecker to account for function type variables

This commit is contained in:
Daniel Kirchner 2020-02-12 12:08:07 +01:00
parent 85348e9af7
commit 45f80e9895
3 changed files with 14 additions and 1 deletions

View File

@ -133,9 +133,9 @@ struct ConstStateVarCircularReferenceChecker: public PostTypeChecker::Checker
bool visit(VariableDeclaration const& _variable) override
{
solAssert(!m_currentConstVariable, "");
if (_variable.isConstant())
{
solAssert(!m_currentConstVariable, "");
m_currentConstVariable = &_variable;
m_constVariables.push_back(&_variable);
}

View File

@ -0,0 +1,6 @@
// Used to cause ICE.
contract C {
function ( ) internal returns ( bytes [ ] storage , mapping ( bytes => mapping ( bytes => mapping ( uint => mapping ( bytes => mapping ( string => mapping ( uint => mapping ( uint => mapping ( uint => mapping ( uint => mapping ( string => mapping ( string => mapping ( uint => mapping ( bytes => mapping ( uint => mapping ( uint => mapping ( uint => mapping ( uint => mapping ( uint => mapping ( bytes => mapping ( uint => mapping ( uint => mapping ( uint => mapping ( uint => mapping ( string => mapping ( uint => string ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) [ ] storage ) constant c = c ;
}
// ----
// TypeError: (43-643): The value of the constant c has a cyclic dependency via c.

View File

@ -0,0 +1,7 @@
contract C {
// Used to cause internal compiler error.
function() returns (x) constant x = x;
}
// ----
// TypeError: (77-78): Name has to refer to a struct, enum or contract.