mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10670 from blishko/smt-virtual-modifiers-fix
[SMTChecker] Fix virtual modifier called statically
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract A {
|
||||
modifier m virtual {
|
||||
_;
|
||||
}
|
||||
}
|
||||
contract C is A {
|
||||
function f() public A.m returns (uint) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract A {
|
||||
int x = 0;
|
||||
|
||||
modifier m virtual {
|
||||
assert(x == 0); // should hold
|
||||
assert(x == 42); // should fail
|
||||
_;
|
||||
}
|
||||
}
|
||||
contract C is A {
|
||||
|
||||
modifier m override {
|
||||
assert(x == 1); // This assert is not reachable, should NOT be reported
|
||||
_;
|
||||
}
|
||||
|
||||
function f() public A.m returns (uint) {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (115-130): CHC: Assertion violation happens here.\nCounterexample:\nx = 0\n\n = 0\n\nTransaction trace:\nconstructor()\nState: x = 0\nf()
|
||||
Reference in New Issue
Block a user