Skip to content

Commit

Permalink
Merge pull request #7823 from ethereum/smt_typetype_msg
Browse files Browse the repository at this point in the history
[SMTChecker] Do not visit the name of a modifier invocation
  • Loading branch information
chriseth authored Nov 27, 2019
2 parents d207ae5 + 240ff30 commit 9ec44c2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
13 changes: 10 additions & 3 deletions libsolidity/formal/SMTEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,15 @@ void SMTEncoder::endVisit(FunctionCall const& _funCall)
}
}

bool SMTEncoder::visit(ModifierInvocation const& _node)
{
if (auto const* args = _node.arguments())
for (auto const& arg: *args)
if (arg)
arg->accept(*this);
return false;
}

void SMTEncoder::initContract(ContractDefinition const& _contract)
{
solAssert(m_currentContract == nullptr, "");
Expand Down Expand Up @@ -605,9 +614,7 @@ void SMTEncoder::endVisit(Identifier const& _identifier)
defineExpr(_identifier, m_context.thisAddress());
m_uninterpretedTerms.insert(&_identifier);
}
else if (
_identifier.annotation().type->category() != Type::Category::Modifier
)
else
createExpr(_identifier);
}

Expand Down
1 change: 1 addition & 0 deletions libsolidity/formal/SMTEncoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class SMTEncoder: public ASTConstVisitor
bool visit(BinaryOperation const& _node) override;
void endVisit(BinaryOperation const& _node) override;
void endVisit(FunctionCall const& _node) override;
bool visit(ModifierInvocation const& _node) override;
void endVisit(Identifier const& _node) override;
void endVisit(ElementaryTypeNameExpression const& _node) override;
void endVisit(Literal const& _node) override;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
pragma experimental SMTChecker;

contract A {
uint x;
constructor() public {
x = 2;
}
}

contract B is A {
constructor() A() public {
x = 3;
}
}
// ----
// Warning: (56-90): Assertion checker does not yet support constructors.
// Warning: (113-151): Assertion checker does not yet support constructors.

0 comments on commit 9ec44c2

Please sign in to comment.