mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[SMTChecker] Inline external function calls to this.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user