mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'origin/develop' into breaking
This commit is contained in:
@@ -257,7 +257,7 @@ void ASTJSONTest::printSource(ostream& _stream, string const& _linePrefix, bool
|
||||
for (auto const& source: m_sources)
|
||||
{
|
||||
if (m_sources.size() > 1 || source.first != "a")
|
||||
_stream << _linePrefix << sourceDelimiter << source.first << endl << endl;
|
||||
_stream << _linePrefix << sourceDelimiter << source.first << " ====" << endl << endl;
|
||||
stringstream stream(source.second);
|
||||
string line;
|
||||
while (getline(stream, line))
|
||||
|
||||
@@ -91,7 +91,7 @@ evmasm::AssemblyItems compileContract(std::shared_ptr<CharStream> _sourceCode)
|
||||
);
|
||||
compiler.compileContract(*contract, map<ContractDefinition const*, shared_ptr<Compiler const>>{}, bytes());
|
||||
|
||||
return compiler.runtimeAssemblyItems();
|
||||
return compiler.runtimeAssembly().items();
|
||||
}
|
||||
BOOST_FAIL("No contract found in source.");
|
||||
return AssemblyItems();
|
||||
|
||||
@@ -38,6 +38,9 @@ namespace solidity::frontend::test
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(SemVerMatcher)
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
SemVerMatchExpression parseExpression(string const& _input)
|
||||
{
|
||||
Scanner scanner{CharStream(_input, "")};
|
||||
@@ -62,6 +65,8 @@ SemVerMatchExpression parseExpression(string const& _input)
|
||||
return expression;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(positive_range)
|
||||
{
|
||||
// Positive range tests
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <libsolidity/ast/TypeProvider.h>
|
||||
#include <libsolidity/analysis/TypeChecker.h>
|
||||
#include <liblangutil/ErrorReporter.h>
|
||||
#include <libevmasm/LinkerObject.h>
|
||||
#include <test/Common.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
@@ -161,7 +162,10 @@ bytes compileFirstExpression(
|
||||
context << context.functionEntryLabel(dynamic_cast<FunctionDefinition const&>(
|
||||
resolveDeclaration(*sourceUnit, function, resolver)
|
||||
));
|
||||
bytes instructions = context.assembledObject().bytecode;
|
||||
BOOST_REQUIRE(context.assemblyPtr());
|
||||
LinkerObject const& object = context.assemblyPtr()->assemble();
|
||||
BOOST_REQUIRE(object.immutableReferences.empty());
|
||||
bytes instructions = object.bytecode;
|
||||
// debug
|
||||
// cout << evmasm::disassemble(instructions) << endl;
|
||||
return instructions;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
contract c {
|
||||
bytes a;
|
||||
bytes b;
|
||||
function f(uint len) public returns (bytes memory) {
|
||||
bytes memory x = new bytes(len);
|
||||
for (uint i = 0; i < len; i++)
|
||||
x[i] = byte(uint8(i));
|
||||
a = x;
|
||||
for (uint i = 0; i < len; i++)
|
||||
assert(a[i] == x[i]);
|
||||
b = a;
|
||||
for (uint i = 0; i < len; i++)
|
||||
assert(b[i] == x[i]);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint256): 0 -> 0x20, 0x00
|
||||
// f(uint256): 31 -> 0x20, 0x1f, 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e00
|
||||
// f(uint256): 32 -> 0x20, 0x20, 1780731860627700044960722568376592200742329637303199754547598369979440671
|
||||
// f(uint256): 33 -> 0x20, 33, 1780731860627700044960722568376592200742329637303199754547598369979440671, 0x2000000000000000000000000000000000000000000000000000000000000000
|
||||
// f(uint256): 63 -> 0x20, 0x3f, 1780731860627700044960722568376592200742329637303199754547598369979440671, 14532552714582660066924456880521368950258152170031413196862950297402215316992
|
||||
// f(uint256): 12 -> 0x20, 0x0c, 0x0102030405060708090a0b0000000000000000000000000000000000000000
|
||||
// f(uint256): 129 -> 0x20, 0x81, 1780731860627700044960722568376592200742329637303199754547598369979440671, 0x202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f, 29063324697304692433803953038474361308315562010425523193971352996434451193439, 0x606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f, -57896044618658097711785492504343953926634992332820282019728792003956564819968
|
||||
@@ -9,3 +9,5 @@ contract C {
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4984: (112-115): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
|
||||
|
||||
@@ -11,4 +11,5 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4984: (112-115): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
|
||||
// Warning 2529: (150-157): CHC: Empty array "pop" happens here.\nCounterexample:\na = []\nl = 0\n\n\nTransaction trace:\nconstructor()\nState: a = []\nf(0)
|
||||
|
||||
+2
@@ -11,3 +11,5 @@ contract C {
|
||||
assert(x[0] == 42);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4984: (174-177): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
uint8 x;
|
||||
|
||||
function inc_pre() public {
|
||||
++x;
|
||||
}
|
||||
|
||||
function dec_pre() public {
|
||||
--x;
|
||||
}
|
||||
|
||||
/* Commented out because Spacer segfaults in Z3 4.8.9
|
||||
function inc_post() public {
|
||||
x++;
|
||||
}
|
||||
|
||||
function dec_post() public {
|
||||
x--;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
// ====
|
||||
// SMTEngine: bmc
|
||||
// ----
|
||||
// Warning 2661: (87-90): BMC: Overflow (resulting value larger than 255) happens here.
|
||||
// Warning 4144: (127-130): BMC: Underflow (resulting value less than 0) happens here.
|
||||
@@ -19,4 +19,3 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 2661: (158-161): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
|
||||
@@ -23,4 +23,3 @@ contract C {
|
||||
// Warning 6328: (274-300): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
|
||||
// Warning 6328: (304-330): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
|
||||
// Warning 6328: (334-362): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
|
||||
// Warning 2661: (158-161): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
|
||||
@@ -28,4 +28,3 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 2661: (188-191): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
|
||||
@@ -38,4 +38,3 @@ contract C {
|
||||
// Warning 6328: (437-458): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (462-490): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (494-517): CHC: Assertion violation happens here.
|
||||
// Warning 2661: (188-191): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
|
||||
@@ -18,5 +18,6 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (189-203): CHC: Assertion violation happens here.\nCounterexample:\nx = 10, d = 0\n\n\n\nTransaction trace:\nconstructor()\nState: x = 0, d = 0\ninc()\nState: x = 1, d = 0\ninc()\nState: x = 2, d = 0\nf()
|
||||
// Warning 4984: (146-149): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
|
||||
// Warning 6328: (189-203): CHC: Assertion violation happens here.\nCounterexample:\nx = 10, d = 0\n\n\n\nTransaction trace:\nconstructor()\nState: x = 0, d = 0\ninc()\nState: x = 1, d = 0\nf()
|
||||
// Warning 2661: (146-149): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
|
||||
@@ -16,3 +16,6 @@ contract C {
|
||||
assert(x < 11);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (200-214): CHC: Assertion violation might happen here.
|
||||
// Warning 4661: (200-214): BMC: Assertion violation happens here.
|
||||
|
||||
@@ -21,5 +21,3 @@ contract C{
|
||||
}
|
||||
// ----
|
||||
// Warning 5667: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning.
|
||||
// Warning 2661: (156-159): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
// Warning 4144: (238-241): BMC: Underflow (resulting value less than 0) happens here.
|
||||
|
||||
@@ -26,5 +26,3 @@ contract C{
|
||||
// Warning 6328: (220-234): CHC: Assertion violation happens here.\nCounterexample:\nx = 2\n\n\n\nTransaction trace:\nconstructor(0)\nState: x = 1\nf()
|
||||
// Warning 6328: (245-259): CHC: Assertion violation happens here.\nCounterexample:\nx = 1\n\n\n\nTransaction trace:\nconstructor(0)\nState: x = 1\nf()
|
||||
// Warning 6328: (82-96): CHC: Assertion violation happens here.\nCounterexample:\nx = 0\ny = 0\n\n\nTransaction trace:\nconstructor(0)
|
||||
// Warning 2661: (156-159): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
// Warning 4144: (238-241): BMC: Underflow (resulting value less than 0) happens here.
|
||||
|
||||
-2
@@ -17,5 +17,3 @@ contract C is A {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4144: (100-103): BMC: Underflow (resulting value less than 0) happens here.
|
||||
// Warning 4144: (100-103): BMC: Underflow (resulting value less than 0) happens here.
|
||||
|
||||
-2
@@ -20,5 +20,3 @@ contract C is A {
|
||||
// Warning 6328: (82-96): CHC: Assertion violation happens here.\nCounterexample:\nx = 1\n\n\n\nTransaction trace:\nconstructor()
|
||||
// Warning 6328: (148-162): CHC: Assertion violation happens here.\nCounterexample:\nx = 0\n\n\n\nTransaction trace:\nconstructor()
|
||||
// Warning 6328: (180-194): CHC: Assertion violation happens here.\nCounterexample:\nx = 0\n\n\n\nTransaction trace:\nconstructor()
|
||||
// Warning 4144: (100-103): BMC: Underflow (resulting value less than 0) happens here.
|
||||
// Warning 4144: (100-103): BMC: Underflow (resulting value less than 0) happens here.
|
||||
|
||||
-4
@@ -21,7 +21,3 @@ contract C{
|
||||
}
|
||||
// ----
|
||||
// Warning 5667: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning.
|
||||
// Warning 2661: (156-159): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
// Warning 2661: (163-166): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
// Warning 2661: (234-237): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
// Warning 4144: (234-237): BMC: Underflow (resulting value less than 0) happens here.
|
||||
|
||||
-4
@@ -24,7 +24,3 @@ contract C{
|
||||
// Warning 6328: (138-152): CHC: Assertion violation happens here.\nCounterexample:\nx = 1\n\n\n\nTransaction trace:\nconstructor(0)\nState: x = 1\nf()
|
||||
// Warning 6328: (184-198): CHC: Assertion violation happens here.\nCounterexample:\nx = 1\n\n\n\nTransaction trace:\nconstructor(0)\nState: x = 1\nf()
|
||||
// Warning 6328: (82-96): CHC: Assertion violation happens here.\nCounterexample:\nx = 0\ny = 0\n\n\nTransaction trace:\nconstructor(0)
|
||||
// Warning 2661: (156-159): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
// Warning 2661: (163-166): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
// Warning 2661: (234-237): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
// Warning 4144: (234-237): BMC: Underflow (resulting value less than 0) happens here.
|
||||
|
||||
@@ -20,6 +20,7 @@ contract Der is Base {
|
||||
// ----
|
||||
// Warning 4984: (der:101-109): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
|
||||
// Warning 6328: (der:113-126): CHC: Assertion violation happens here.\nCounterexample:\nx = 3, a = 0\ny = 0\n\n\nTransaction trace:\nconstructor()\nState: x = 0, a = 0\ng(0)
|
||||
// Warning 4984: (base:100-103): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
|
||||
// Warning 2661: (base:100-103): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
// Warning 2661: (der:101-109): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
// Warning 2661: (base:100-103): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
|
||||
@@ -11,3 +11,5 @@ contract Simple {
|
||||
}
|
||||
// ====
|
||||
// SMTSolvers: z3
|
||||
// ----
|
||||
// Warning 4984: (132-135): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
|
||||
|
||||
@@ -9,3 +9,5 @@ contract Simple {
|
||||
}
|
||||
// ====
|
||||
// SMTSolvers: z3
|
||||
// ----
|
||||
// Warning 4984: (116-119): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
|
||||
|
||||
@@ -15,4 +15,4 @@ contract C
|
||||
// SMTSolvers: z3
|
||||
// ----
|
||||
// Warning 5740: (120-123): Unreachable code.
|
||||
// Warning 6328: (131-145): CHC: Assertion violation happens here.\nCounterexample:\n\nx = 1\n\n\nTransaction trace:\nconstructor()\nf(1)
|
||||
// Warning 6328: (131-145): CHC: Assertion violation happens here.\nCounterexample:\n\nx = 3\n\n\nTransaction trace:\nconstructor()\nf(3)
|
||||
|
||||
+2
-1
@@ -18,9 +18,10 @@ contract LoopFor2 {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTSolvers: z3
|
||||
// SMTIgnoreCex: yes
|
||||
// SMTSolvers: z3
|
||||
// ----
|
||||
// Warning 4984: (244-249): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
|
||||
// Warning 4984: (270-273): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
|
||||
// Warning 6328: (373-392): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (396-415): CHC: Assertion violation happens here.
|
||||
|
||||
@@ -26,3 +26,4 @@ contract LoopFor2 {
|
||||
// SMTSolvers: z3
|
||||
// ----
|
||||
// Warning 4984: (237-242): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
|
||||
// Warning 4984: (263-266): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
|
||||
|
||||
@@ -21,5 +21,6 @@ contract LoopFor2 {
|
||||
}
|
||||
// ----
|
||||
// Warning 4984: (229-234): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
|
||||
// Warning 4984: (255-258): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
|
||||
// Warning 6328: (338-357): CHC: Assertion violation happens here.\nCounterexample:\nb = [], c = []\nn = 1\n\n\nTransaction trace:\nconstructor()\nState: b = [], c = []\ntestUnboundedForLoop(1)
|
||||
// Warning 6328: (361-380): CHC: Assertion violation happens here.\nCounterexample:\nb = [], c = []\nn = 1\n\n\nTransaction trace:\nconstructor()\nState: b = [], c = []\ntestUnboundedForLoop(1)
|
||||
|
||||
@@ -7,7 +7,7 @@ contract A {
|
||||
A.y = A.x++;
|
||||
assert(A.y == A.x - 1);
|
||||
// Fails
|
||||
assert(A.y == 0);
|
||||
// assert(A.y == 0); // Disabled because of nondeterminism in Spacer
|
||||
A.y = ++A.x;
|
||||
assert(A.y == A.x);
|
||||
delete A.x;
|
||||
@@ -25,6 +25,7 @@ contract A {
|
||||
assert(A.y == A.x);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTIgnoreCex: yes
|
||||
// ----
|
||||
// Warning 6328: (160-176): CHC: Assertion violation happens here.\nCounterexample:\nx = (- 1), y = (- 2)\n\n\n\nTransaction trace:\nconstructor()\nState: x = 0, y = 0\na()\nState: x = (- 2), y = (- 2)\na()
|
||||
// Warning 6328: (373-389): CHC: Assertion violation happens here.\nCounterexample:\nx = 8, y = (- 2)\n\n\n\nTransaction trace:\nconstructor()\nState: x = 0, y = 0\na()
|
||||
// Warning 6328: (424-440): CHC: Assertion violation happens here.
|
||||
|
||||
@@ -10,4 +10,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (161-174): CHC: Assertion violation happens here.\nCounterexample:\n\na = 6\nb = 5\n\n\nTransaction trace:\nconstructor()\nf(5, 5)
|
||||
// Warning 6328: (161-174): CHC: Assertion violation happens here.\nCounterexample:\n\na = 0\nb = 1\n\n\nTransaction trace:\nconstructor()\nf(0, 0)
|
||||
|
||||
@@ -10,3 +10,6 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4984: (129-134): CHC: Overflow (resulting value larger than 2**256 - 1) happens here.\nCounterexample:\na = 115792089237316195423570985008687907853269984665640564039457584007913129639935, b = false\n\nc = 0\n\nTransaction trace:\nconstructor()\nState: a = 0, b = false\nf()\nState: a = 115792089237316195423570985008687907853269984665640564039457584007913129639935, b = false\nf()
|
||||
// Warning 3944: (137-140): CHC: Underflow (resulting value less than 0) happens here.\nCounterexample:\na = 0, b = false\n\nc = 0\n\nTransaction trace:\nconstructor()\nState: a = 0, b = false\nf()
|
||||
// Warning 6328: (150-163): CHC: Assertion violation happens here.\nCounterexample:\na = 115792089237316195423570985008687907853269984665640564039457584007913129639935, b = false\n\nc = 0\n\nTransaction trace:\nconstructor()\nState: a = 0, b = false\nf()
|
||||
|
||||
@@ -15,4 +15,4 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (240-253): CHC: Assertion violation happens here.\nCounterexample:\narray = []\nx = 38\n\n\nTransaction trace:\nconstructor()\nState: array = []\nf(38)
|
||||
// Warning 6328: (240-253): CHC: Assertion violation happens here.
|
||||
|
||||
@@ -14,5 +14,7 @@ contract C
|
||||
assert(b < 3);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTIgnoreCex: yes
|
||||
// ----
|
||||
// Warning 6328: (244-257): CHC: Assertion violation happens here.\nCounterexample:\n\nx = 38\n\n\nTransaction trace:\nconstructor()\nf(38)
|
||||
// Warning 6328: (244-257): CHC: Assertion violation happens here.
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
uint8 x;
|
||||
|
||||
function inc_pre() public {
|
||||
++x;
|
||||
}
|
||||
|
||||
function dec_pre() public {
|
||||
--x;
|
||||
}
|
||||
|
||||
/* Commented out because Spacer segfaults in Z3 4.8.9
|
||||
function inc_post() public {
|
||||
x++;
|
||||
}
|
||||
|
||||
function dec_post() public {
|
||||
x--;
|
||||
}
|
||||
*/
|
||||
}
|
||||
// ----
|
||||
// Warning 4984: (87-90): CHC: Overflow (resulting value larger than 255) happens here.\nCounterexample:\nx = 255\n\n\n\nTransaction trace:\nconstructor()\nState: x = 0\ndec_pre()\nState: x = 255\ninc_pre()
|
||||
// Warning 3944: (127-130): CHC: Underflow (resulting value less than 0) happens here.\nCounterexample:\nx = 0\n\n\n\nTransaction trace:\nconstructor()\nState: x = 0\ndec_pre()
|
||||
@@ -0,0 +1,16 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
uint8 x = 254;
|
||||
|
||||
function inc_pre() public {
|
||||
++x;
|
||||
}
|
||||
|
||||
function check() view public {
|
||||
uint y = x;
|
||||
assert(y < 256);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4984: (94-97): CHC: Overflow (resulting value larger than 255) happens here.\nCounterexample:\nx = 255\n\n\n\nTransaction trace:\nconstructor()\nState: x = 254\ninc_pre()\nState: x = 255\ninc_pre()
|
||||
@@ -0,0 +1,24 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
uint8 x;
|
||||
}
|
||||
|
||||
S s;
|
||||
|
||||
constructor() {
|
||||
s.x = 254;
|
||||
}
|
||||
|
||||
function inc_pre() public {
|
||||
++s.x;
|
||||
}
|
||||
|
||||
function check() view public {
|
||||
uint y = s.x;
|
||||
assert(y < 256);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4984: (145-150): CHC: Overflow (resulting value larger than 255) happens here.\nCounterexample:\ns = {x: 255}\n\n\n\nTransaction trace:\nconstructor()\nState: s = {x: 254}\ninc_pre()\nState: s = {x: 255}\ninc_pre()
|
||||
@@ -15,4 +15,4 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (240-253): CHC: Assertion violation happens here.\nCounterexample:\narray = []\nx = 38\n\n\nTransaction trace:\nconstructor()\nState: array = []\nf(38)
|
||||
// Warning 6328: (240-253): CHC: Assertion violation happens here.\nCounterexample:\narray = []\nx = 0\n\n\nTransaction trace:\nconstructor()\nState: array = []\nf(0)
|
||||
|
||||
@@ -15,4 +15,4 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (244-257): CHC: Assertion violation happens here.\nCounterexample:\n\nx = 38\n\n\nTransaction trace:\nconstructor()\nf(38)
|
||||
// Warning 6328: (244-257): CHC: Assertion violation happens here.\nCounterexample:\n\nx = 0\n\n\nTransaction trace:\nconstructor()\nf(0)
|
||||
|
||||
@@ -52,6 +52,10 @@ contract C {
|
||||
// Warning 8364: (258-260): Assertion checker does not yet implement type struct C.S storage ref
|
||||
// Warning 7650: (271-275): Assertion checker does not yet support this expression.
|
||||
// Warning 8364: (271-273): Assertion checker does not yet implement type struct C.S storage ref
|
||||
// Warning 4984: (132-138): CHC: Overflow (resulting value larger than 2**256 - 1) happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
|
||||
// Warning 4984: (142-148): CHC: Overflow (resulting value larger than 2**256 - 1) happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
|
||||
// Warning 3944: (165-171): CHC: Underflow (resulting value less than 0) happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
|
||||
// Warning 3944: (175-181): CHC: Underflow (resulting value less than 0) happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
|
||||
// Warning 4984: (200-208): CHC: Overflow (resulting value larger than 2**256 - 1) happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
|
||||
// Warning 6328: (185-209): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
|
||||
// Warning 6328: (213-247): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
|
||||
@@ -87,11 +91,3 @@ contract C {
|
||||
// Warning 8364: (258-260): Assertion checker does not yet implement type struct C.S storage ref
|
||||
// Warning 7650: (271-275): Assertion checker does not yet support this expression.
|
||||
// Warning 8364: (271-273): Assertion checker does not yet implement type struct C.S storage ref
|
||||
// Warning 4144: (132-138): BMC: Underflow (resulting value less than 0) happens here.
|
||||
// Warning 2661: (132-138): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
// Warning 4144: (142-148): BMC: Underflow (resulting value less than 0) happens here.
|
||||
// Warning 2661: (142-148): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
// Warning 4144: (165-171): BMC: Underflow (resulting value less than 0) happens here.
|
||||
// Warning 2661: (165-171): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
// Warning 4144: (175-181): BMC: Underflow (resulting value less than 0) happens here.
|
||||
// Warning 2661: (175-181): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
|
||||
@@ -15,4 +15,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (225-245): CHC: Assertion violation happens here.\nCounterexample:\n\ns1 = {x: 2, a: []}\ns2 = {x: 3, a: [5, 5, 5, 5, 5, 5]}\n\n\nTransaction trace:\nconstructor()\nf({x: 0, a: []}, {x: 3, a: [5, 5, 5, 5, 5, 5]})
|
||||
// Warning 6328: (225-245): CHC: Assertion violation happens here.\nCounterexample:\n\ns1 = {x: 2, a: []}\ns2 = {x: 3, a: [6, 6, 6, 6, 6, 6, 6]}\n\n\nTransaction trace:\nconstructor()\nf({x: 0, a: []}, {x: 3, a: [6, 6, 6, 6, 6, 6, 6]})
|
||||
|
||||
@@ -16,4 +16,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (240-260): CHC: Assertion violation happens here.\nCounterexample:\n\ns1 = {x: 98, a: []}\ns2 = {x: (- 38), a: [5, 5, 5, 5, 5, 5]}\n\n\nTransaction trace:\nconstructor()\nf({x: 0, a: []}, {x: (- 38), a: [5, 5, 5, 5, 5, 5]})
|
||||
// Warning 6328: (240-260): CHC: Assertion violation happens here.\nCounterexample:\n\ns1 = {x: 98, a: []}\ns2 = {x: 99, a: [6, 6, 6, 6, 6, 6, 6]}\n\n\nTransaction trace:\nconstructor()\nf({x: 0, a: []}, {x: 99, a: [6, 6, 6, 6, 6, 6, 6]})
|
||||
|
||||
@@ -12,6 +12,7 @@ contract C {
|
||||
if(x == 0) x = 0; // noop state var read
|
||||
x++;
|
||||
y++;
|
||||
assert(y == x);
|
||||
// Commented out because of nondeterminism in Spacer in Z3 4.8.9
|
||||
//assert(y == x);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,4 +22,4 @@ contract Test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9574: (B:269-313): Type function (struct L.Item memory) is not implicitly convertible to expected type function (struct L.Item memory) external.
|
||||
// TypeError 9574: (B:269-313): Type function (struct L.Item memory) is not implicitly convertible to expected type function (struct L.Item memory) external. Special functions can not be converted to function types.
|
||||
|
||||
@@ -30,6 +30,6 @@ contract E {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9553: (140-143): Invalid type for argument in function call. Invalid implicit conversion from function () to function () external requested.
|
||||
// TypeError 9553: (230-233): Invalid type for argument in function call. Invalid implicit conversion from function () to function () external requested.
|
||||
// TypeError 9553: (345-348): Invalid type for argument in function call. Invalid implicit conversion from function D.f() to function () external requested.
|
||||
// TypeError 9553: (140-143): Invalid type for argument in function call. Invalid implicit conversion from function () to function () external requested. Special functions can not be converted to function types.
|
||||
// TypeError 9553: (230-233): Invalid type for argument in function call. Invalid implicit conversion from function () to function () external requested. Special functions can not be converted to function types.
|
||||
// TypeError 9553: (345-348): Invalid type for argument in function call. Invalid implicit conversion from function D.f() to function () external requested. Special functions can not be converted to function types.
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
library L {
|
||||
function foo(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||
return a + b;
|
||||
}
|
||||
}
|
||||
contract C {
|
||||
using L for uint256;
|
||||
|
||||
function bar() public {
|
||||
uint256 x;
|
||||
function (uint256, uint256) internal pure returns (uint256) ptr = x.foo;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9574: (209-280): Type function (uint256,uint256) pure returns (uint256) is not implicitly convertible to expected type function (uint256,uint256) pure returns (uint256). Bound functions can not be converted to non-bound functions.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public {
|
||||
function (uint) view returns (bytes32) _blockhash = blockhash;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9574: (42-103): Type function (uint256) view returns (bytes32) is not implicitly convertible to expected type function (uint256) view returns (bytes32). Special functions can not be converted to function types.
|
||||
+2
-2
@@ -10,5 +10,5 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9553: (230-233): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) returns (uint256) to function (uint256) external returns (uint256) requested.
|
||||
// TypeError 9574: (244-305): Type function (uint256) returns (uint256) is not implicitly convertible to expected type function (uint256) external returns (uint256).
|
||||
// TypeError 9553: (230-233): Invalid type for argument in function call. Invalid implicit conversion from function (uint256) returns (uint256) to function (uint256) external returns (uint256) requested. Special functions can not be converted to function types.
|
||||
// TypeError 9574: (244-305): Type function (uint256) returns (uint256) is not implicitly convertible to expected type function (uint256) external returns (uint256). Special functions can not be converted to function types.
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@ contract test {
|
||||
function(bytes memory) external internal a = fa;
|
||||
}
|
||||
// ----
|
||||
// TypeError 7407: (106-108): Type function (bytes memory) is not implicitly convertible to expected type function (bytes memory) external.
|
||||
// TypeError 7407: (106-108): Type function (bytes memory) is not implicitly convertible to expected type function (bytes memory) external. Special functions can not be converted to function types.
|
||||
|
||||
@@ -9,5 +9,5 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9574: (218-271): Type function (struct D.s storage pointer,uint256) returns (uint256) is not implicitly convertible to expected type function (struct D.s storage pointer,uint256) returns (uint256).
|
||||
// TypeError 9574: (218-271): Type function (struct D.s storage pointer,uint256) returns (uint256) is not implicitly convertible to expected type function (struct D.s storage pointer,uint256) returns (uint256). Bound functions can not be converted to non-bound functions.
|
||||
// TypeError 6160: (298-302): Wrong argument count for function call: 1 arguments given but expected 2.
|
||||
|
||||
+2
-2
@@ -10,5 +10,5 @@ contract B is A {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9574: (133-160): Type function A.f() is not implicitly convertible to expected type function () external.
|
||||
// TypeError 9574: (170-202): Type function A.g() pure is not implicitly convertible to expected type function () pure external.
|
||||
// TypeError 9574: (133-160): Type function A.f() is not implicitly convertible to expected type function () external. Special functions can not be converted to function types.
|
||||
// TypeError 9574: (170-202): Type function A.g() pure is not implicitly convertible to expected type function () pure external. Special functions can not be converted to function types.
|
||||
|
||||
+2
-2
@@ -10,5 +10,5 @@ contract B {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9574: (128-155): Type function A.f() is not implicitly convertible to expected type function () external.
|
||||
// TypeError 9574: (165-197): Type function A.g() pure is not implicitly convertible to expected type function () pure external.
|
||||
// TypeError 9574: (128-155): Type function A.f() is not implicitly convertible to expected type function () external. Special functions can not be converted to function types.
|
||||
// TypeError 9574: (165-197): Type function A.g() pure is not implicitly convertible to expected type function () pure external. Special functions can not be converted to function types.
|
||||
|
||||
@@ -39,6 +39,9 @@ namespace solidity::frontend::test
|
||||
using fmt = ExecutionFramework;
|
||||
using Mode = FunctionCall::DisplayMode;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
vector<FunctionCall> parse(string const& _source)
|
||||
{
|
||||
istringstream stream{_source, ios_base::out};
|
||||
@@ -86,6 +89,8 @@ void testFunctionCall(
|
||||
BOOST_REQUIRE_EQUAL(_call.kind == FunctionCall::Kind::Library, _isLibrary);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(TestFileParserTest)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(smoke_test)
|
||||
|
||||
Reference in New Issue
Block a user