[SMTChecker] Inline external function calls to this.

This commit is contained in:
Leonardo Alt
2019-05-09 16:53:30 +02:00
parent c3a1c168d0
commit ef32bf185f
8 changed files with 108 additions and 6 deletions
@@ -9,4 +9,5 @@ contract C {
}
}
// ----
// Warning: (99-107): Assertion checker does not support recursive function calls.
// Warning: (141-144): Assertion checker does not support recursive function calls.
@@ -0,0 +1,14 @@
pragma experimental SMTChecker;
contract C
{
uint x;
function f(uint y) public {
x = y;
}
function g(uint y) public {
require(y < 1000);
this.f(y);
assert(x < 1000);
}
}
@@ -0,0 +1,15 @@
pragma experimental SMTChecker;
contract C
{
uint x;
function f(uint y) public returns (uint) {
x = y;
return x;
}
function g(uint y) public {
require(y < 1000);
uint z = this.f(y);
assert(z < 1000);
}
}
@@ -0,0 +1,24 @@
pragma experimental SMTChecker;
contract C
{
uint public x;
C c;
function f(C _c) public {
c = _c;
}
function g() public {
C this = c;
x = 0;
this.h();
// State knowledge is erased.
// Function call is not inlined.
assert(x == 0);
}
function h() public {
x = 2;
}
}
// ----
// Warning: (160-166): This declaration shadows a builtin symbol.
// Warning: (268-282): Assertion violation happens here
@@ -0,0 +1,15 @@
pragma experimental SMTChecker;
contract C
{
uint public x;
function g() public {
x = 0;
this.h();
// Function call is inlined.
assert(x == 2);
}
function h() public {
x = 2;
}
}