Merge pull request #7210 from ethereum/smt_fix_type_mismatch

[SMTChecker] Support StringLiteral type
This commit is contained in:
Leonardo
2019-08-12 14:32:43 +02:00
committed by GitHub
19 changed files with 206 additions and 56 deletions
@@ -53,9 +53,6 @@ contract MyConc{
// ----
// Warning: (773-792): This declaration shadows an existing declaration.
// Warning: (1009-1086): Function state mutability can be restricted to view
// Warning: (327-332): Assertion checker does not yet support the type of this literal (literal_string "abc").
// Warning: (353-358): Assertion checker does not yet support the type of this literal (literal_string "xyz").
// Warning: (834-839): Assertion checker does not yet support the type of this literal (literal_string "abc").
// Warning: (874-879): Underflow (resulting value less than 0) happens here.
// Warning: (874-879): Overflow (resulting value larger than 2**256 - 1) happens here.
// Warning: (985-1002): Overflow (resulting value larger than 2**256 - 1) happens here.
@@ -83,7 +83,6 @@ contract InternalCall {
// Warning: (1144-1206): Function state mutability can be restricted to pure
// Warning: (1212-1274): Function state mutability can be restricted to pure
// Warning: (1280-1342): Function state mutability can be restricted to pure
// Warning: (799-811): Assertion checker does not yet support the type of this literal (literal_string "helloTwo()").
// Warning: (782-813): Type conversion is not yet fully supported and might yield false positives.
// Warning: (771-814): Assertion checker does not yet implement this type of function call.
// Warning: (825-830): Assertion checker does not yet support the type of this variable.
@@ -6,7 +6,5 @@ contract C {
}
// ----
// Warning: (31-64): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning: (173-175): Assertion checker does not yet support the type of this literal (literal_string "").
// Warning: (162-176): Assertion checker does not yet implement this type of function call.
// Warning: (196-202): Assertion checker does not yet support the type of this literal (literal_string "7?8r").
// Warning: (178-203): Assertion checker does not yet implement this type of function call.
@@ -8,4 +8,3 @@ contract C
}
// ----
// Warning: (76-91): Unused local variable.
// Warning: (94-107): Assertion checker does not yet support the type of this literal (literal_string "Hello World").
@@ -0,0 +1,13 @@
pragma experimental SMTChecker;
contract C {
function f(bytes32 _x) public pure {
require(_x == "test");
bytes32 y = "test";
bytes16 z = "testz";
assert(_x == y);
assert(_x == z);
}
}
// ----
// Warning: (175-190): Assertion violation happens here
@@ -0,0 +1,12 @@
pragma experimental SMTChecker;
contract C {
function f(bytes32 _x) public pure {
require(_x == "test");
(bytes32 y, bytes16 z) = ("test", "testz");
assert(_x == y);
assert(_x == z);
}
}
// ----
// Warning: (176-191): Assertion violation happens here
@@ -0,0 +1,14 @@
pragma experimental SMTChecker;
contract C {
function f(bytes32 _x) public pure {
require(_x == "test");
bytes32 y;
bytes16 z;
(y, z) = ("test", "testz");
assert(_x == y);
assert(_x == z);
}
}
// ----
// Warning: (186-201): Assertion violation happens here
@@ -0,0 +1,18 @@
pragma experimental SMTChecker;
contract C {
function g() internal pure returns (bytes32, bytes16) {
return ("test", "testz");
}
function f(bytes32 _x) public pure {
require(_x == "test");
bytes32 y;
bytes16 z;
(y, z) = g();
assert(_x == y);
assert(_x == z);
}
}
// ----
// Warning: (261-276): Assertion violation happens here
@@ -0,0 +1,16 @@
pragma experimental SMTChecker;
contract C {
function g() internal pure returns (bytes32, bytes16) {
return ("test", "testz");
}
function f(bytes32 _x) public pure {
require(_x == "test");
(bytes32 y, bytes16 z) = g();
assert(_x == y);
assert(_x == z);
}
}
// ----
// Warning: (251-266): Assertion violation happens here
@@ -0,0 +1,13 @@
pragma experimental SMTChecker;
contract C {
function f(bytes32 _x) public pure {
require(_x == "test");
bytes32 y = _x;
bytes32 z = _x;
assert(z == "test");
assert(y == "testx");
}
}
// ----
// Warning: (170-190): Assertion violation happens here
@@ -0,0 +1,13 @@
pragma experimental SMTChecker;
contract C {
function f(bytes32 _x) public pure {
require(_x != "test");
bytes32 y = _x;
bytes32 z = _x;
assert(z == "test");
assert(y != "testx");
}
}
// ----
// Warning: (147-166): Assertion violation happens here
@@ -6,4 +6,3 @@ contract C {
}
}
// ----
// Warning: (97-125): Assertion checker does not yet support the type of this literal (literal_string "Input number is too large.").