-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Using For #33
Comments
Can you clarify what you mean for support for using-for or add a sample that you wish to be supported? When I try to instrument the following sample: library L {
function plusOne(uint x) internal pure returns (uint) {
return x + 1;
}
}
contract Foo {
using L for uint;
/// if_succeeds old(x).plusOne() == x;
function inc(uint x) public returns (uint) {
return x + 1;
}
} I get the following instrumented code, which seems correct: pragma solidity 0.8.3;
library L {
function plusOne(uint x) internal pure returns (uint) {
return x + 1;
}
}
contract Foo {
using L for uint;
event AssertionFailed(string message);
struct vars0 {
uint256 old_0;
}
function inc(uint x) public returns (uint RET_0) {
vars0 memory _v;
unchecked {
_v.old_0 = x;
}
RET_0 = _original_Foo_inc(x);
unchecked {
if (!(_v.old_0.plusOne() == x)) {
emit AssertionFailed("0: ");
assert(false);
}
}
}
function _original_Foo_inc(uint x) private returns (uint) {
return x + 1;
}
}
/// Utility contract holding a stack counter
contract __scribble_ReentrancyUtils {
bool __scribble_out_of_contract = true;
} |
Your example works, but this one does not pragma solidity >=0.6.0 <0.8.0;
library Token {
function balanceOf(address x) internal pure returns (uint) {
return 123;
}
}
contract Foo {
using Token for address;
/// if_succeeds x.balanceOf() == 123;
function balanceOf(address x) public returns (uint) {
return x.balanceOf();
}
}
|
Got it! Thank you for the sample. Will try to fix this promptly |
The issue is that the typechecking logic below is too aggressive. The same problem would happen if the argument was |
Сan you add support for similar solidity instructions?
solidity using-for
The text was updated successfully, but these errors were encountered: