aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SMTChecker.cpp17
-rw-r--r--test/libsolidity/SemVerMatcher.cpp6
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp109
-rw-r--r--test/libsolidity/SolidityExpressionCompiler.cpp228
-rw-r--r--test/libsolidity/SolidityTypes.cpp2
-rw-r--r--test/libsolidity/smtCheckerTests/special/blockhash.sol10
-rw-r--r--test/libsolidity/smtCheckerTests/special/difficulty.sol10
-rw-r--r--test/libsolidity/smtCheckerTests/special/gasleft.sol14
-rw-r--r--test/libsolidity/smtCheckerTests/special/many.sol25
-rw-r--r--test/libsolidity/smtCheckerTests/special/msg_data.sol14
-rw-r--r--test/libsolidity/smtCheckerTests/special/msg_sender_1.sol10
-rw-r--r--test/libsolidity/smtCheckerTests/special/msg_sender_2.sol14
-rw-r--r--test/libsolidity/smtCheckerTests/special/msg_sender_fail_1.sol13
-rw-r--r--test/libsolidity/smtCheckerTests/special/msg_sig.sol10
-rw-r--r--test/libsolidity/smtCheckerTests/types/fixed_bytes_1.sol16
-rw-r--r--test/libsolidity/syntaxTests/array/length/parameter_too_large.sol5
-rw-r--r--test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim.sol11
-rw-r--r--test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim_ABIv2.sol10
-rw-r--r--test/libsolidity/syntaxTests/conversion/function_type_nonpayable_payable.sol10
-rw-r--r--test/libsolidity/syntaxTests/conversion/function_type_nonpayable_pure.sol10
-rw-r--r--test/libsolidity/syntaxTests/conversion/function_type_nonpayable_view.sol10
-rw-r--r--test/libsolidity/syntaxTests/conversion/function_type_payable_nonpayable.sol8
-rw-r--r--test/libsolidity/syntaxTests/conversion/function_type_payable_pure.sol10
-rw-r--r--test/libsolidity/syntaxTests/conversion/function_type_payable_view.sol10
-rw-r--r--test/libsolidity/syntaxTests/conversion/function_type_pure_nonpayable.sol8
-rw-r--r--test/libsolidity/syntaxTests/conversion/function_type_pure_payable.sol10
-rw-r--r--test/libsolidity/syntaxTests/conversion/function_type_pure_view.sol8
-rw-r--r--test/libsolidity/syntaxTests/conversion/function_type_same.sol14
-rw-r--r--test/libsolidity/syntaxTests/conversion/function_type_view_nonpayable.sol10
-rw-r--r--test/libsolidity/syntaxTests/conversion/function_type_view_payable.sol10
-rw-r--r--test/libsolidity/syntaxTests/conversion/function_type_view_pure.sol10
-rw-r--r--test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg.sol13
-rw-r--r--test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_function_name.sol10
-rw-r--r--test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol10
-rw-r--r--test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable_in_assign.sol11
-rw-r--r--test/libsolidity/syntaxTests/types/rational_negative_numerator_negative_exp.sol5
36 files changed, 527 insertions, 174 deletions
diff --git a/test/libsolidity/SMTChecker.cpp b/test/libsolidity/SMTChecker.cpp
index c7e60256..195004cb 100644
--- a/test/libsolidity/SMTChecker.cpp
+++ b/test/libsolidity/SMTChecker.cpp
@@ -133,23 +133,6 @@ BOOST_AUTO_TEST_CASE(assignment_in_declaration)
CHECK_SUCCESS_NO_WARNINGS(text);
}
-BOOST_AUTO_TEST_CASE(function_call_does_not_clear_local_vars)
-{
- string text = R"(
- contract C {
- function g() public pure {}
- function f() public view {
- uint a = 3;
- this.g();
- assert(a == 3);
- g();
- assert(a == 3);
- }
- }
- )";
- CHECK_WARNING(text, "Assertion checker does not yet implement this type of function call");
-}
-
BOOST_AUTO_TEST_CASE(branches_merge_variables)
{
// Branch does not touch variable a
diff --git a/test/libsolidity/SemVerMatcher.cpp b/test/libsolidity/SemVerMatcher.cpp
index 07f8fba6..43951f73 100644
--- a/test/libsolidity/SemVerMatcher.cpp
+++ b/test/libsolidity/SemVerMatcher.cpp
@@ -42,13 +42,13 @@ SemVerMatchExpression parseExpression(string const& _input)
{
Scanner scanner{CharStream(_input)};
vector<string> literals;
- vector<Token::Value> tokens;
+ vector<Token> tokens;
while (scanner.currentToken() != Token::EOS)
{
auto token = scanner.currentToken();
string literal = scanner.currentLiteral();
- if (literal.empty() && Token::toString(token))
- literal = Token::toString(token);
+ if (literal.empty() && TokenTraits::toString(token))
+ literal = TokenTraits::toString(token);
literals.push_back(literal);
tokens.push_back(token);
scanner.next();
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 7a496e64..87646737 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -1259,14 +1259,14 @@ BOOST_AUTO_TEST_CASE(state_smoke_test)
}
)";
compileAndRun(sourceCode);
- ABI_CHECK(callContractFunction("get(uint8)", byte(0x00)), encodeArgs(0));
- ABI_CHECK(callContractFunction("get(uint8)", byte(0x01)), encodeArgs(0));
- ABI_CHECK(callContractFunction("set(uint8,uint256)", byte(0x00), 0x1234), encodeArgs());
- ABI_CHECK(callContractFunction("set(uint8,uint256)", byte(0x01), 0x8765), encodeArgs());
- ABI_CHECK(callContractFunction("get(uint8)", byte( 0x00)), encodeArgs(0x1234));
- ABI_CHECK(callContractFunction("get(uint8)", byte(0x01)), encodeArgs(0x8765));
- ABI_CHECK(callContractFunction("set(uint8,uint256)", byte(0x00), 0x3), encodeArgs());
- ABI_CHECK(callContractFunction("get(uint8)", byte(0x00)), encodeArgs(0x3));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(0x00)), encodeArgs(0));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(0x01)), encodeArgs(0));
+ ABI_CHECK(callContractFunction("set(uint8,uint256)", uint8_t(0x00), 0x1234), encodeArgs());
+ ABI_CHECK(callContractFunction("set(uint8,uint256)", uint8_t(0x01), 0x8765), encodeArgs());
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t( 0x00)), encodeArgs(0x1234));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(0x01)), encodeArgs(0x8765));
+ ABI_CHECK(callContractFunction("set(uint8,uint256)", uint8_t(0x00), 0x3), encodeArgs());
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(0x00)), encodeArgs(0x3));
}
BOOST_AUTO_TEST_CASE(compound_assign)
@@ -1321,21 +1321,21 @@ BOOST_AUTO_TEST_CASE(simple_mapping)
)";
compileAndRun(sourceCode);
- ABI_CHECK(callContractFunction("get(uint8)", byte(0)), encodeArgs(byte(0x00)));
- ABI_CHECK(callContractFunction("get(uint8)", byte(0x01)), encodeArgs(byte(0x00)));
- ABI_CHECK(callContractFunction("get(uint8)", byte(0xa7)), encodeArgs(byte(0x00)));
- callContractFunction("set(uint8,uint8)", byte(0x01), byte(0xa1));
- ABI_CHECK(callContractFunction("get(uint8)", byte(0x00)), encodeArgs(byte(0x00)));
- ABI_CHECK(callContractFunction("get(uint8)", byte(0x01)), encodeArgs(byte(0xa1)));
- ABI_CHECK(callContractFunction("get(uint8)", byte(0xa7)), encodeArgs(byte(0x00)));
- callContractFunction("set(uint8,uint8)", byte(0x00), byte(0xef));
- ABI_CHECK(callContractFunction("get(uint8)", byte(0x00)), encodeArgs(byte(0xef)));
- ABI_CHECK(callContractFunction("get(uint8)", byte(0x01)), encodeArgs(byte(0xa1)));
- ABI_CHECK(callContractFunction("get(uint8)", byte(0xa7)), encodeArgs(byte(0x00)));
- callContractFunction("set(uint8,uint8)", byte(0x01), byte(0x05));
- ABI_CHECK(callContractFunction("get(uint8)", byte(0x00)), encodeArgs(byte(0xef)));
- ABI_CHECK(callContractFunction("get(uint8)", byte(0x01)), encodeArgs(byte(0x05)));
- ABI_CHECK(callContractFunction("get(uint8)", byte(0xa7)), encodeArgs(byte(0x00)));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(0)), encodeArgs(uint8_t(0x00)));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(0x01)), encodeArgs(uint8_t(0x00)));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(0xa7)), encodeArgs(uint8_t(0x00)));
+ callContractFunction("set(uint8,uint8)", uint8_t(0x01), uint8_t(0xa1));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(0x00)), encodeArgs(uint8_t(0x00)));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(0x01)), encodeArgs(uint8_t(0xa1)));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(0xa7)), encodeArgs(uint8_t(0x00)));
+ callContractFunction("set(uint8,uint8)", uint8_t(0x00), uint8_t(0xef));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(0x00)), encodeArgs(uint8_t(0xef)));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(0x01)), encodeArgs(uint8_t(0xa1)));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(0xa7)), encodeArgs(uint8_t(0x00)));
+ callContractFunction("set(uint8,uint8)", uint8_t(0x01), uint8_t(0x05));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(0x00)), encodeArgs(uint8_t(0xef)));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(0x01)), encodeArgs(uint8_t(0x05)));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(0xa7)), encodeArgs(uint8_t(0x00)));
}
BOOST_AUTO_TEST_CASE(mapping_state)
@@ -1496,7 +1496,7 @@ BOOST_AUTO_TEST_CASE(mapping_local_assignment)
)";
compileAndRun(sourceCode);
- ABI_CHECK(callContractFunction("f()"), encodeArgs(byte(42), byte(0), byte(0), byte(21)));
+ ABI_CHECK(callContractFunction("f()"), encodeArgs(uint8_t(42), uint8_t(0), uint8_t(0), uint8_t(21)));
}
BOOST_AUTO_TEST_CASE(mapping_local_tuple_assignment)
@@ -1519,7 +1519,7 @@ BOOST_AUTO_TEST_CASE(mapping_local_tuple_assignment)
)";
compileAndRun(sourceCode);
- ABI_CHECK(callContractFunction("f()"), encodeArgs(byte(42), byte(0), byte(0), byte(21)));
+ ABI_CHECK(callContractFunction("f()"), encodeArgs(uint8_t(42), uint8_t(0), uint8_t(0), uint8_t(21)));
}
BOOST_AUTO_TEST_CASE(mapping_local_compound_assignment)
@@ -1540,7 +1540,7 @@ BOOST_AUTO_TEST_CASE(mapping_local_compound_assignment)
)";
compileAndRun(sourceCode);
- ABI_CHECK(callContractFunction("f()"), encodeArgs(byte(42), byte(0), byte(0), byte(21)));
+ ABI_CHECK(callContractFunction("f()"), encodeArgs(uint8_t(42), uint8_t(0), uint8_t(0), uint8_t(21)));
}
BOOST_AUTO_TEST_CASE(mapping_internal_argument)
@@ -1565,10 +1565,10 @@ BOOST_AUTO_TEST_CASE(mapping_internal_argument)
)";
compileAndRun(sourceCode);
- ABI_CHECK(callContractFunction("set(uint8,uint8,uint8)", byte(1), byte(21), byte(42)), encodeArgs(byte(0), byte(0)));
- ABI_CHECK(callContractFunction("get(uint8)", byte(1)), encodeArgs(byte(21), byte(42)));
- ABI_CHECK(callContractFunction("set(uint8,uint8,uint8)", byte(1), byte(10), byte(11)), encodeArgs(byte(21), byte(42)));
- ABI_CHECK(callContractFunction("get(uint8)", byte(1)), encodeArgs(byte(10), byte(11)));
+ ABI_CHECK(callContractFunction("set(uint8,uint8,uint8)", uint8_t(1), uint8_t(21), uint8_t(42)), encodeArgs(uint8_t(0), uint8_t(0)));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(1)), encodeArgs(uint8_t(21), uint8_t(42)));
+ ABI_CHECK(callContractFunction("set(uint8,uint8,uint8)", uint8_t(1), uint8_t(10), uint8_t(11)), encodeArgs(uint8_t(21), uint8_t(42)));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(1)), encodeArgs(uint8_t(10), uint8_t(11)));
}
BOOST_AUTO_TEST_CASE(mapping_array_internal_argument)
@@ -1595,10 +1595,10 @@ BOOST_AUTO_TEST_CASE(mapping_array_internal_argument)
)";
compileAndRun(sourceCode);
- ABI_CHECK(callContractFunction("set(uint8,uint8,uint8,uint8,uint8)", byte(1), byte(21), byte(22), byte(42), byte(43)), encodeArgs(byte(0), byte(0), byte(0), byte(0)));
- ABI_CHECK(callContractFunction("get(uint8)", byte(1)), encodeArgs(byte(21), byte(22), byte(42), byte(43)));
- ABI_CHECK(callContractFunction("set(uint8,uint8,uint8,uint8,uint8)", byte(1), byte(10), byte(30), byte(11), byte(31)), encodeArgs(byte(21), byte(22), byte(42), byte(43)));
- ABI_CHECK(callContractFunction("get(uint8)", byte(1)), encodeArgs(byte(10), byte(30), byte(11), byte(31)));
+ ABI_CHECK(callContractFunction("set(uint8,uint8,uint8,uint8,uint8)", uint8_t(1), uint8_t(21), uint8_t(22), uint8_t(42), uint8_t(43)), encodeArgs(uint8_t(0), uint8_t(0), uint8_t(0), uint8_t(0)));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(1)), encodeArgs(uint8_t(21), uint8_t(22), uint8_t(42), uint8_t(43)));
+ ABI_CHECK(callContractFunction("set(uint8,uint8,uint8,uint8,uint8)", uint8_t(1), uint8_t(10), uint8_t(30), uint8_t(11), uint8_t(31)), encodeArgs(uint8_t(21), uint8_t(22), uint8_t(42), uint8_t(43)));
+ ABI_CHECK(callContractFunction("get(uint8)", uint8_t(1)), encodeArgs(uint8_t(10), uint8_t(30), uint8_t(11), uint8_t(31)));
}
BOOST_AUTO_TEST_CASE(mapping_internal_return)
@@ -1626,8 +1626,8 @@ BOOST_AUTO_TEST_CASE(mapping_internal_return)
)";
compileAndRun(sourceCode);
- ABI_CHECK(callContractFunction("g()"), encodeArgs(byte(0), byte(42), byte(0), byte(0), byte(84), byte (21)));
- ABI_CHECK(callContractFunction("h()"), encodeArgs(byte(0), byte(42), byte(0), byte(0), byte(84), byte (17)));
+ ABI_CHECK(callContractFunction("g()"), encodeArgs(uint8_t(0), uint8_t(42), uint8_t(0), uint8_t(0), uint8_t(84), uint8_t (21)));
+ ABI_CHECK(callContractFunction("h()"), encodeArgs(uint8_t(0), uint8_t(42), uint8_t(0), uint8_t(0), uint8_t(84), uint8_t (17)));
}
BOOST_AUTO_TEST_CASE(structs)
@@ -1787,6 +1787,24 @@ BOOST_AUTO_TEST_CASE(deleteLocals)
ABI_CHECK(callContractFunction("delLocal()"), encodeArgs(6, 7));
}
+BOOST_AUTO_TEST_CASE(deleteLength)
+{
+ char const* sourceCode = R"(
+ contract test {
+ uint[] x;
+ function f() public returns (uint){
+ x.length = 1;
+ x[0] = 1;
+ delete x.length;
+ return x.length;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ ABI_CHECK(callContractFunction("f()"), encodeArgs(0));
+ BOOST_CHECK(storageEmpty(m_contractAddress));
+}
+
BOOST_AUTO_TEST_CASE(constructor)
{
char const* sourceCode = R"(
@@ -1801,7 +1819,7 @@ BOOST_AUTO_TEST_CASE(constructor)
}
)";
compileAndRun(sourceCode);
- map<u256, byte> data;
+ map<u256, uint8_t> data;
data[7] = 8;
auto get = [&](u256 const& _x) -> u256
{
@@ -2606,7 +2624,7 @@ BOOST_AUTO_TEST_CASE(ecrecover)
)";
compileAndRun(sourceCode);
u256 h("0x18c547e4f7b0f325ad1e56f57e26c745b09a3e503d86e00e5255ff7f715d3d1c");
- byte v = 28;
+ uint8_t v = 28;
u256 r("0x73b1693892219d736caba55bdb67216e485557ea6b6af75f37096c9aa6a5a75f");
u256 s("0xeeb940b1d03b21e36b0e47e79769f095fe2ab855bd91e3a38756b7d75a9c4549");
u160 addr("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b");
@@ -14010,6 +14028,21 @@ BOOST_AUTO_TEST_CASE(test_underscore_in_hex)
ABI_CHECK(callContractFunction("f(bool)", false), encodeArgs(u256(0x1234abcd1234)));
}
+BOOST_AUTO_TEST_CASE(flipping_sign_tests)
+{
+ char const* sourceCode = R"(
+ contract test {
+ function f() public returns (bool){
+ int x = -2**255;
+ assert(-x == x);
+ return true;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ ABI_CHECK(callContractFunction("f()"), encodeArgs(true));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}
diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp
index 26b7914f..309cbf0b 100644
--- a/test/libsolidity/SolidityExpressionCompiler.cpp
+++ b/test/libsolidity/SolidityExpressionCompiler.cpp
@@ -180,7 +180,7 @@ BOOST_AUTO_TEST_CASE(literal_true)
)";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(Instruction::PUSH1), 0x1});
+ bytes expectation({uint8_t(Instruction::PUSH1), 0x1});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -193,7 +193,7 @@ BOOST_AUTO_TEST_CASE(literal_false)
)";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(Instruction::PUSH1), 0x0});
+ bytes expectation({uint8_t(Instruction::PUSH1), 0x0});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -206,7 +206,7 @@ BOOST_AUTO_TEST_CASE(int_literal)
)";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(Instruction::PUSH10), 0x12, 0x34, 0x56, 0x78, 0x90,
+ bytes expectation({uint8_t(Instruction::PUSH10), 0x12, 0x34, 0x56, 0x78, 0x90,
0x12, 0x34, 0x56, 0x78, 0x90});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -222,7 +222,7 @@ BOOST_AUTO_TEST_CASE(int_with_wei_ether_subdenomination)
)";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(Instruction::PUSH1), 0x1});
+ bytes expectation({uint8_t(Instruction::PUSH1), 0x1});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -237,7 +237,7 @@ BOOST_AUTO_TEST_CASE(int_with_szabo_ether_subdenomination)
)";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(Instruction::PUSH5), 0xe8, 0xd4, 0xa5, 0x10, 0x00});
+ bytes expectation({uint8_t(Instruction::PUSH5), 0xe8, 0xd4, 0xa5, 0x10, 0x00});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -253,7 +253,7 @@ BOOST_AUTO_TEST_CASE(int_with_finney_ether_subdenomination)
)";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(Instruction::PUSH7), 0x3, 0x8d, 0x7e, 0xa4, 0xc6, 0x80, 0x00});
+ bytes expectation({uint8_t(Instruction::PUSH7), 0x3, 0x8d, 0x7e, 0xa4, 0xc6, 0x80, 0x00});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -268,7 +268,7 @@ BOOST_AUTO_TEST_CASE(int_with_ether_ether_subdenomination)
)";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(Instruction::PUSH8), 0xd, 0xe0, 0xb6, 0xb3, 0xa7, 0x64, 0x00, 0x00});
+ bytes expectation({uint8_t(Instruction::PUSH8), 0xd, 0xe0, 0xb6, 0xb3, 0xa7, 0x64, 0x00, 0x00});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -281,12 +281,12 @@ BOOST_AUTO_TEST_CASE(comparison)
)";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(Instruction::PUSH1), 0x1, byte(Instruction::ISZERO), byte(Instruction::ISZERO),
- byte(Instruction::PUSH2), 0x11, 0xaa,
- byte(Instruction::PUSH2), 0x10, 0xaa,
- byte(Instruction::LT), byte(Instruction::ISZERO), byte(Instruction::ISZERO),
- byte(Instruction::EQ),
- byte(Instruction::ISZERO)});
+ bytes expectation({uint8_t(Instruction::PUSH1), 0x1, uint8_t(Instruction::ISZERO), uint8_t(Instruction::ISZERO),
+ uint8_t(Instruction::PUSH2), 0x11, 0xaa,
+ uint8_t(Instruction::PUSH2), 0x10, 0xaa,
+ uint8_t(Instruction::LT), uint8_t(Instruction::ISZERO), uint8_t(Instruction::ISZERO),
+ uint8_t(Instruction::EQ),
+ uint8_t(Instruction::ISZERO)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -299,23 +299,23 @@ BOOST_AUTO_TEST_CASE(short_circuiting)
)";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(Instruction::PUSH1), 0x12, // 8 + 10
- byte(Instruction::PUSH1), 0x4,
- byte(Instruction::GT),
- byte(Instruction::ISZERO), // after this we have 4 <= 8 + 10
- byte(Instruction::DUP1),
- byte(Instruction::PUSH1), 0x11,
- byte(Instruction::JUMPI), // short-circuit if it is true
- byte(Instruction::POP),
- byte(Instruction::PUSH1), 0x2,
- byte(Instruction::PUSH1), 0x9,
- byte(Instruction::EQ),
- byte(Instruction::ISZERO), // after this we have 9 != 2
- byte(Instruction::JUMPDEST),
- byte(Instruction::ISZERO), byte(Instruction::ISZERO),
- byte(Instruction::PUSH1), 0x1, byte(Instruction::ISZERO), byte(Instruction::ISZERO),
- byte(Instruction::EQ),
- byte(Instruction::ISZERO)});
+ bytes expectation({uint8_t(Instruction::PUSH1), 0x12, // 8 + 10
+ uint8_t(Instruction::PUSH1), 0x4,
+ uint8_t(Instruction::GT),
+ uint8_t(Instruction::ISZERO), // after this we have 4 <= 8 + 10
+ uint8_t(Instruction::DUP1),
+ uint8_t(Instruction::PUSH1), 0x11,
+ uint8_t(Instruction::JUMPI), // short-circuit if it is true
+ uint8_t(Instruction::POP),
+ uint8_t(Instruction::PUSH1), 0x2,
+ uint8_t(Instruction::PUSH1), 0x9,
+ uint8_t(Instruction::EQ),
+ uint8_t(Instruction::ISZERO), // after this we have 9 != 2
+ uint8_t(Instruction::JUMPDEST),
+ uint8_t(Instruction::ISZERO), uint8_t(Instruction::ISZERO),
+ uint8_t(Instruction::PUSH1), 0x1, uint8_t(Instruction::ISZERO), uint8_t(Instruction::ISZERO),
+ uint8_t(Instruction::EQ),
+ uint8_t(Instruction::ISZERO)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -327,37 +327,37 @@ BOOST_AUTO_TEST_CASE(arithmetic)
}
)";
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "y"}});
- bytes expectation({byte(Instruction::PUSH1), 0x1,
- byte(Instruction::PUSH1), 0x2,
- byte(Instruction::PUSH1), 0x3,
- byte(Instruction::PUSH1), 0x4,
- byte(Instruction::PUSH1), 0x5,
- byte(Instruction::PUSH1), 0x6,
- byte(Instruction::PUSH1), 0x7,
- byte(Instruction::PUSH1), 0x8,
- byte(Instruction::DUP9),
- byte(Instruction::XOR),
- byte(Instruction::AND),
- byte(Instruction::OR),
- byte(Instruction::SUB),
- byte(Instruction::ADD),
- byte(Instruction::DUP2),
- byte(Instruction::ISZERO),
- byte(Instruction::ISZERO),
- byte(Instruction::PUSH1), 0x1d,
- byte(Instruction::JUMPI),
- byte(Instruction::INVALID),
- byte(Instruction::JUMPDEST),
- byte(Instruction::MOD),
- byte(Instruction::DUP2),
- byte(Instruction::ISZERO),
- byte(Instruction::ISZERO),
- byte(Instruction::PUSH1), 0x26,
- byte(Instruction::JUMPI),
- byte(Instruction::INVALID),
- byte(Instruction::JUMPDEST),
- byte(Instruction::DIV),
- byte(Instruction::MUL)});
+ bytes expectation({uint8_t(Instruction::PUSH1), 0x1,
+ uint8_t(Instruction::PUSH1), 0x2,
+ uint8_t(Instruction::PUSH1), 0x3,
+ uint8_t(Instruction::PUSH1), 0x4,
+ uint8_t(Instruction::PUSH1), 0x5,
+ uint8_t(Instruction::PUSH1), 0x6,
+ uint8_t(Instruction::PUSH1), 0x7,
+ uint8_t(Instruction::PUSH1), 0x8,
+ uint8_t(Instruction::DUP9),
+ uint8_t(Instruction::XOR),
+ uint8_t(Instruction::AND),
+ uint8_t(Instruction::OR),
+ uint8_t(Instruction::SUB),
+ uint8_t(Instruction::ADD),
+ uint8_t(Instruction::DUP2),
+ uint8_t(Instruction::ISZERO),
+ uint8_t(Instruction::ISZERO),
+ uint8_t(Instruction::PUSH1), 0x1d,
+ uint8_t(Instruction::JUMPI),
+ uint8_t(Instruction::INVALID),
+ uint8_t(Instruction::JUMPDEST),
+ uint8_t(Instruction::MOD),
+ uint8_t(Instruction::DUP2),
+ uint8_t(Instruction::ISZERO),
+ uint8_t(Instruction::ISZERO),
+ uint8_t(Instruction::PUSH1), 0x26,
+ uint8_t(Instruction::JUMPI),
+ uint8_t(Instruction::INVALID),
+ uint8_t(Instruction::JUMPDEST),
+ uint8_t(Instruction::DIV),
+ uint8_t(Instruction::MUL)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -370,13 +370,13 @@ BOOST_AUTO_TEST_CASE(unary_operators)
)";
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "y"}});
- bytes expectation({byte(Instruction::PUSH1), 0x2,
- byte(Instruction::DUP2),
- byte(Instruction::PUSH1), 0x0,
- byte(Instruction::SUB),
- byte(Instruction::NOT),
- byte(Instruction::EQ),
- byte(Instruction::ISZERO)});
+ bytes expectation({uint8_t(Instruction::PUSH1), 0x2,
+ uint8_t(Instruction::DUP2),
+ uint8_t(Instruction::PUSH1), 0x0,
+ uint8_t(Instruction::SUB),
+ uint8_t(Instruction::NOT),
+ uint8_t(Instruction::EQ),
+ uint8_t(Instruction::ISZERO)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -390,47 +390,47 @@ BOOST_AUTO_TEST_CASE(unary_inc_dec)
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "a"}, {"test", "f", "x"}});
// Stack: a, x
- bytes expectation({byte(Instruction::DUP2),
- byte(Instruction::DUP1),
- byte(Instruction::PUSH1), 0x1,
- byte(Instruction::ADD),
+ bytes expectation({uint8_t(Instruction::DUP2),
+ uint8_t(Instruction::DUP1),
+ uint8_t(Instruction::PUSH1), 0x1,
+ uint8_t(Instruction::ADD),
// Stack here: a x a (a+1)
- byte(Instruction::SWAP3),
- byte(Instruction::POP), // first ++
+ uint8_t(Instruction::SWAP3),
+ uint8_t(Instruction::POP), // first ++
// Stack here: (a+1) x a
- byte(Instruction::DUP3),
- byte(Instruction::PUSH1), 0x1,
- byte(Instruction::ADD),
+ uint8_t(Instruction::DUP3),
+ uint8_t(Instruction::PUSH1), 0x1,
+ uint8_t(Instruction::ADD),
// Stack here: (a+1) x a (a+2)
- byte(Instruction::SWAP3),
- byte(Instruction::POP),
+ uint8_t(Instruction::SWAP3),
+ uint8_t(Instruction::POP),
// Stack here: (a+2) x a
- byte(Instruction::DUP3), // second ++
- byte(Instruction::XOR),
+ uint8_t(Instruction::DUP3), // second ++
+ uint8_t(Instruction::XOR),
// Stack here: (a+2) x a^(a+2)
- byte(Instruction::DUP3),
- byte(Instruction::DUP1),
- byte(Instruction::PUSH1), 0x1,
- byte(Instruction::SWAP1),
- byte(Instruction::SUB),
+ uint8_t(Instruction::DUP3),
+ uint8_t(Instruction::DUP1),
+ uint8_t(Instruction::PUSH1), 0x1,
+ uint8_t(Instruction::SWAP1),
+ uint8_t(Instruction::SUB),
// Stack here: (a+2) x a^(a+2) (a+2) (a+1)
- byte(Instruction::SWAP4),
- byte(Instruction::POP), // first --
- byte(Instruction::XOR),
+ uint8_t(Instruction::SWAP4),
+ uint8_t(Instruction::POP), // first --
+ uint8_t(Instruction::XOR),
// Stack here: (a+1) x a^(a+2)^(a+2)
- byte(Instruction::DUP3),
- byte(Instruction::PUSH1), 0x1,
- byte(Instruction::SWAP1),
- byte(Instruction::SUB),
+ uint8_t(Instruction::DUP3),
+ uint8_t(Instruction::PUSH1), 0x1,
+ uint8_t(Instruction::SWAP1),
+ uint8_t(Instruction::SUB),
// Stack here: (a+1) x a^(a+2)^(a+2) a
- byte(Instruction::SWAP3),
- byte(Instruction::POP), // second ++
+ uint8_t(Instruction::SWAP3),
+ uint8_t(Instruction::POP), // second ++
// Stack here: a x a^(a+2)^(a+2)
- byte(Instruction::DUP3), // will change
- byte(Instruction::XOR),
- byte(Instruction::SWAP1),
- byte(Instruction::POP),
- byte(Instruction::DUP1)});
+ uint8_t(Instruction::DUP3), // will change
+ uint8_t(Instruction::XOR),
+ uint8_t(Instruction::SWAP1),
+ uint8_t(Instruction::POP),
+ uint8_t(Instruction::DUP1)});
// Stack here: a x a^(a+2)^(a+2)^a
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -445,16 +445,16 @@ BOOST_AUTO_TEST_CASE(assignment)
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "a"}, {"test", "f", "b"}});
// Stack: a, b
- bytes expectation({byte(Instruction::PUSH1), 0x2,
- byte(Instruction::DUP2),
- byte(Instruction::DUP4),
- byte(Instruction::ADD),
+ bytes expectation({uint8_t(Instruction::PUSH1), 0x2,
+ uint8_t(Instruction::DUP2),
+ uint8_t(Instruction::DUP4),
+ uint8_t(Instruction::ADD),
// Stack here: a b 2 a+b
- byte(Instruction::SWAP3),
- byte(Instruction::POP),
- byte(Instruction::DUP3),
+ uint8_t(Instruction::SWAP3),
+ uint8_t(Instruction::POP),
+ uint8_t(Instruction::DUP3),
// Stack here: a+b b 2 a+b
- byte(Instruction::MUL)});
+ uint8_t(Instruction::MUL)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -467,7 +467,7 @@ BOOST_AUTO_TEST_CASE(negative_literals_8bits)
)";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation(bytes({byte(Instruction::PUSH32)}) + bytes(31, 0xff) + bytes(1, 0x80));
+ bytes expectation(bytes({uint8_t(Instruction::PUSH32)}) + bytes(31, 0xff) + bytes(1, 0x80));
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -480,7 +480,7 @@ BOOST_AUTO_TEST_CASE(negative_literals_16bits)
)";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation(bytes({byte(Instruction::PUSH32)}) + bytes(30, 0xff) + bytes{0xf5, 0x43});
+ bytes expectation(bytes({uint8_t(Instruction::PUSH32)}) + bytes(30, 0xff) + bytes{0xf5, 0x43});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -495,7 +495,7 @@ BOOST_AUTO_TEST_CASE(intermediately_overflowing_literals)
)";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation(bytes({byte(Instruction::PUSH1), 0xbf}));
+ bytes expectation(bytes({uint8_t(Instruction::PUSH1), 0xbf}));
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -514,8 +514,8 @@ BOOST_AUTO_TEST_CASE(blockhash)
bytes code = compileFirstExpression(sourceCode, {}, {}, {make_shared<MagicVariableDeclaration>("blockhash", blockhashFun)});
- bytes expectation({byte(Instruction::PUSH1), 0x03,
- byte(Instruction::BLOCKHASH)});
+ bytes expectation({uint8_t(Instruction::PUSH1), 0x03,
+ uint8_t(Instruction::BLOCKHASH)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -533,7 +533,7 @@ BOOST_AUTO_TEST_CASE(gas_left)
{make_shared<MagicVariableDeclaration>("gasleft", make_shared<FunctionType>(strings(), strings{"uint256"}, FunctionType::Kind::GasLeft))}
);
- bytes expectation = bytes({byte(Instruction::GAS)});
+ bytes expectation = bytes({uint8_t(Instruction::GAS)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
diff --git a/test/libsolidity/SolidityTypes.cpp b/test/libsolidity/SolidityTypes.cpp
index d6310921..6f9d4ce8 100644
--- a/test/libsolidity/SolidityTypes.cpp
+++ b/test/libsolidity/SolidityTypes.cpp
@@ -157,9 +157,7 @@ BOOST_AUTO_TEST_CASE(type_identifiers)
BOOST_CHECK_EQUAL(RationalNumberType(rational(7, 1)).identifier(), "t_rational_7_by_1");
BOOST_CHECK_EQUAL(RationalNumberType(rational(200, 77)).identifier(), "t_rational_200_by_77");
BOOST_CHECK_EQUAL(RationalNumberType(rational(2 * 200, 2 * 77)).identifier(), "t_rational_200_by_77");
- BOOST_CHECK_EQUAL(RationalNumberType(rational(-2 * 200, -2 * 77)).identifier(), "t_rational_200_by_77");
BOOST_CHECK_EQUAL(RationalNumberType(rational(-2 * 200, 2 * 77)).identifier(), "t_rational_minus_200_by_77");
- BOOST_CHECK_EQUAL(RationalNumberType(rational(2 * 200, -2 * 77)).identifier(), "t_rational_minus_200_by_77");
BOOST_CHECK_EQUAL(
StringLiteralType(Literal(SourceLocation{}, Token::StringLiteral, make_shared<string>("abc - def"))).identifier(),
"t_stringliteral_196a9142ee0d40e274a6482393c762b16dd8315713207365e1e13d8d85b74fc4"
diff --git a/test/libsolidity/smtCheckerTests/special/blockhash.sol b/test/libsolidity/smtCheckerTests/special/blockhash.sol
new file mode 100644
index 00000000..1c693914
--- /dev/null
+++ b/test/libsolidity/smtCheckerTests/special/blockhash.sol
@@ -0,0 +1,10 @@
+pragma experimental SMTChecker;
+
+contract C
+{
+ function f() public payable {
+ assert(blockhash(2) > 0);
+ }
+}
+// ----
+// Warning: (79-103): Assertion violation happens here
diff --git a/test/libsolidity/smtCheckerTests/special/difficulty.sol b/test/libsolidity/smtCheckerTests/special/difficulty.sol
new file mode 100644
index 00000000..4469d4e5
--- /dev/null
+++ b/test/libsolidity/smtCheckerTests/special/difficulty.sol
@@ -0,0 +1,10 @@
+pragma experimental SMTChecker;
+
+contract C
+{
+ function f(uint difficulty) public view {
+ assert(block.difficulty == difficulty);
+ }
+}
+// ----
+// Warning: (91-129): Assertion violation happens here
diff --git a/test/libsolidity/smtCheckerTests/special/gasleft.sol b/test/libsolidity/smtCheckerTests/special/gasleft.sol
new file mode 100644
index 00000000..857230fe
--- /dev/null
+++ b/test/libsolidity/smtCheckerTests/special/gasleft.sol
@@ -0,0 +1,14 @@
+pragma experimental SMTChecker;
+
+contract C
+{
+ function f() public view {
+ assert(gasleft() > 0);
+ uint g = gasleft();
+ assert(g < gasleft());
+ assert(g >= gasleft());
+ }
+}
+// ----
+// Warning: (76-97): Assertion violation happens here
+// Warning: (123-144): Assertion violation happens here
diff --git a/test/libsolidity/smtCheckerTests/special/many.sol b/test/libsolidity/smtCheckerTests/special/many.sol
new file mode 100644
index 00000000..40e5d987
--- /dev/null
+++ b/test/libsolidity/smtCheckerTests/special/many.sol
@@ -0,0 +1,25 @@
+pragma experimental SMTChecker;
+
+contract C
+{
+ function f() public payable {
+ assert(msg.sender == block.coinbase);
+ assert(block.difficulty == block.gaslimit);
+ assert(block.number == block.timestamp);
+ assert(tx.gasprice == msg.value);
+ assert(tx.origin == msg.sender);
+ uint x = block.number;
+ assert(x + 2 > block.number);
+ assert(now > 10);
+ assert(gasleft() > 100);
+ }
+}
+// ----
+// Warning: (79-115): Assertion violation happens here
+// Warning: (119-161): Assertion violation happens here
+// Warning: (165-204): Assertion violation happens here
+// Warning: (208-240): Assertion violation happens here
+// Warning: (244-275): Assertion violation happens here
+// Warning: (311-316): Overflow (resulting value larger than 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) happens here
+// Warning: (336-352): Assertion violation happens here
+// Warning: (356-379): Assertion violation happens here
diff --git a/test/libsolidity/smtCheckerTests/special/msg_data.sol b/test/libsolidity/smtCheckerTests/special/msg_data.sol
new file mode 100644
index 00000000..7e748f09
--- /dev/null
+++ b/test/libsolidity/smtCheckerTests/special/msg_data.sol
@@ -0,0 +1,14 @@
+pragma experimental SMTChecker;
+
+contract C
+{
+ function f() public payable {
+ assert(msg.data.length > 0);
+ }
+}
+// ----
+// Warning: (86-101): Assertion checker does not yet support this expression.
+// Warning: (86-94): Assertion checker does not yet support this special variable.
+// Warning: (86-94): Assertion checker does not yet implement this type.
+// Warning: (86-101): Internal error: Expression undefined for SMT solver.
+// Warning: (79-106): Assertion violation happens here
diff --git a/test/libsolidity/smtCheckerTests/special/msg_sender_1.sol b/test/libsolidity/smtCheckerTests/special/msg_sender_1.sol
new file mode 100644
index 00000000..dd2366e2
--- /dev/null
+++ b/test/libsolidity/smtCheckerTests/special/msg_sender_1.sol
@@ -0,0 +1,10 @@
+pragma experimental SMTChecker;
+
+contract C
+{
+ function f() public view {
+ address a = msg.sender;
+ address b = msg.sender;
+ assert(a == b);
+ }
+}
diff --git a/test/libsolidity/smtCheckerTests/special/msg_sender_2.sol b/test/libsolidity/smtCheckerTests/special/msg_sender_2.sol
new file mode 100644
index 00000000..ad45d076
--- /dev/null
+++ b/test/libsolidity/smtCheckerTests/special/msg_sender_2.sol
@@ -0,0 +1,14 @@
+pragma experimental SMTChecker;
+
+contract C
+{
+ function f() public view {
+ require(msg.sender != address(0));
+ address a = msg.sender;
+ address b = msg.sender;
+ assert(a == b);
+ }
+}
+// ----
+// Warning: (98-108): Assertion checker does not yet implement this expression.
+// Warning: (98-108): Internal error: Expression undefined for SMT solver.
diff --git a/test/libsolidity/smtCheckerTests/special/msg_sender_fail_1.sol b/test/libsolidity/smtCheckerTests/special/msg_sender_fail_1.sol
new file mode 100644
index 00000000..9a4eefd5
--- /dev/null
+++ b/test/libsolidity/smtCheckerTests/special/msg_sender_fail_1.sol
@@ -0,0 +1,13 @@
+pragma experimental SMTChecker;
+
+contract C
+{
+ function f(address c) public view {
+ address a = msg.sender;
+ address b = msg.sender;
+ assert(a == b);
+ assert(c == msg.sender);
+ }
+}
+// ----
+// Warning: (155-178): Assertion violation happens here
diff --git a/test/libsolidity/smtCheckerTests/special/msg_sig.sol b/test/libsolidity/smtCheckerTests/special/msg_sig.sol
new file mode 100644
index 00000000..109470a8
--- /dev/null
+++ b/test/libsolidity/smtCheckerTests/special/msg_sig.sol
@@ -0,0 +1,10 @@
+pragma experimental SMTChecker;
+
+contract C
+{
+ function f() public payable {
+ assert(msg.sig == 0x00000000);
+ }
+}
+// ----
+// Warning: (79-108): Assertion violation happens here
diff --git a/test/libsolidity/smtCheckerTests/types/fixed_bytes_1.sol b/test/libsolidity/smtCheckerTests/types/fixed_bytes_1.sol
new file mode 100644
index 00000000..541fff54
--- /dev/null
+++ b/test/libsolidity/smtCheckerTests/types/fixed_bytes_1.sol
@@ -0,0 +1,16 @@
+pragma experimental SMTChecker;
+
+contract C
+{
+ bytes32 x;
+ function f(bytes8 y) public view {
+ assert(x != y);
+ assert(x != g());
+ }
+ function g() public view returns (bytes32) {
+ return x;
+ }
+}
+// ----
+// Warning: (96-110): Assertion violation happens here
+// Warning: (114-130): Assertion violation happens here
diff --git a/test/libsolidity/syntaxTests/array/length/parameter_too_large.sol b/test/libsolidity/syntaxTests/array/length/parameter_too_large.sol
new file mode 100644
index 00000000..02e0a7cc
--- /dev/null
+++ b/test/libsolidity/syntaxTests/array/length/parameter_too_large.sol
@@ -0,0 +1,5 @@
+contract C {
+ function f(bytes32[1263941234127518272] memory) public pure {}
+}
+// ----
+// TypeError: (26-61): Array is too large to be encoded.
diff --git a/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim.sol b/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim.sol
new file mode 100644
index 00000000..5f96ecd5
--- /dev/null
+++ b/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim.sol
@@ -0,0 +1,11 @@
+contract C {
+ function f(bytes32[1263941234127518272][500] memory) public pure {}
+ function f(uint[2**30][] memory) public pure {}
+ function f(uint[2**30][2**30][] memory) public pure {}
+ function f(uint[2**16][2**16][] memory) public pure {}
+}
+// ----
+// TypeError: (26-66): Array is too large to be encoded.
+// TypeError: (96-116): Array is too large to be encoded.
+// TypeError: (146-173): Array is too large to be encoded.
+// TypeError: (203-230): Array is too large to be encoded.
diff --git a/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim_ABIv2.sol b/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim_ABIv2.sol
new file mode 100644
index 00000000..de1fde3f
--- /dev/null
+++ b/test/libsolidity/syntaxTests/array/length/parameter_too_large_multidim_ABIv2.sol
@@ -0,0 +1,10 @@
+pragma experimental ABIEncoderV2;
+
+contract C {
+ function f(bytes32[1263941234127518272][500] memory) public pure {}
+ function f(uint[2**30][2**30][][] memory) public pure {}
+}
+// ----
+// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
+// TypeError: (61-101): Array is too large to be encoded.
+// TypeError: (131-160): Array is too large to be encoded.
diff --git a/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_payable.sol b/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_payable.sol
new file mode 100644
index 00000000..75f7a953
--- /dev/null
+++ b/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_payable.sol
@@ -0,0 +1,10 @@
+contract C {
+ function h() external {
+ }
+ function f() view external returns (bytes4) {
+ function () payable external g = this.h;
+ return g.selector;
+ }
+}
+// ----
+// TypeError: (105-144): Type function () external is not implicitly convertible to expected type function () payable external.
diff --git a/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_pure.sol b/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_pure.sol
new file mode 100644
index 00000000..8d1b08aa
--- /dev/null
+++ b/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_pure.sol
@@ -0,0 +1,10 @@
+contract C {
+ function h() external {
+ }
+ function f() view external returns (bytes4) {
+ function () pure external g = this.h;
+ return g.selector;
+ }
+}
+// ----
+// TypeError: (105-141): Type function () external is not implicitly convertible to expected type function () pure external.
diff --git a/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_view.sol b/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_view.sol
new file mode 100644
index 00000000..535d6c77
--- /dev/null
+++ b/test/libsolidity/syntaxTests/conversion/function_type_nonpayable_view.sol
@@ -0,0 +1,10 @@
+contract C {
+ function h() external {
+ }
+ function f() view external returns (bytes4) {
+ function () view external g = this.h;
+ return g.selector;
+ }
+}
+// ----
+// TypeError: (105-141): Type function () external is not implicitly convertible to expected type function () view external.
diff --git a/test/libsolidity/syntaxTests/conversion/function_type_payable_nonpayable.sol b/test/libsolidity/syntaxTests/conversion/function_type_payable_nonpayable.sol
new file mode 100644
index 00000000..299d7e30
--- /dev/null
+++ b/test/libsolidity/syntaxTests/conversion/function_type_payable_nonpayable.sol
@@ -0,0 +1,8 @@
+contract C {
+ function h() payable external {
+ }
+ function f() view external returns (bytes4) {
+ function () external g = this.h;
+ return g.selector;
+ }
+}
diff --git a/test/libsolidity/syntaxTests/conversion/function_type_payable_pure.sol b/test/libsolidity/syntaxTests/conversion/function_type_payable_pure.sol
new file mode 100644
index 00000000..78bada51
--- /dev/null
+++ b/test/libsolidity/syntaxTests/conversion/function_type_payable_pure.sol
@@ -0,0 +1,10 @@
+contract C {
+ function h() payable external {
+ }
+ function f() view external returns (bytes4) {
+ function () pure external g = this.h;
+ return g.selector;
+ }
+}
+// ----
+// TypeError: (113-149): Type function () payable external is not implicitly convertible to expected type function () pure external.
diff --git a/test/libsolidity/syntaxTests/conversion/function_type_payable_view.sol b/test/libsolidity/syntaxTests/conversion/function_type_payable_view.sol
new file mode 100644
index 00000000..f12cb301
--- /dev/null
+++ b/test/libsolidity/syntaxTests/conversion/function_type_payable_view.sol
@@ -0,0 +1,10 @@
+contract C {
+ function h() payable external {
+ }
+ function f() view external returns (bytes4) {
+ function () view external g = this.h;
+ return g.selector;
+ }
+}
+// ----
+// TypeError: (113-149): Type function () payable external is not implicitly convertible to expected type function () view external.
diff --git a/test/libsolidity/syntaxTests/conversion/function_type_pure_nonpayable.sol b/test/libsolidity/syntaxTests/conversion/function_type_pure_nonpayable.sol
new file mode 100644
index 00000000..7742e0c1
--- /dev/null
+++ b/test/libsolidity/syntaxTests/conversion/function_type_pure_nonpayable.sol
@@ -0,0 +1,8 @@
+contract C {
+ function h() pure external {
+ }
+ function f() view external returns (bytes4) {
+ function () external g = this.h;
+ return g.selector;
+ }
+}
diff --git a/test/libsolidity/syntaxTests/conversion/function_type_pure_payable.sol b/test/libsolidity/syntaxTests/conversion/function_type_pure_payable.sol
new file mode 100644
index 00000000..cd4e9b4e
--- /dev/null
+++ b/test/libsolidity/syntaxTests/conversion/function_type_pure_payable.sol
@@ -0,0 +1,10 @@
+contract C {
+ function h() pure external {
+ }
+ function f() view external returns (bytes4) {
+ function () payable external g = this.h;
+ return g.selector;
+ }
+}
+// ----
+// TypeError: (110-149): Type function () pure external is not implicitly convertible to expected type function () payable external.
diff --git a/test/libsolidity/syntaxTests/conversion/function_type_pure_view.sol b/test/libsolidity/syntaxTests/conversion/function_type_pure_view.sol
new file mode 100644
index 00000000..578ecdbd
--- /dev/null
+++ b/test/libsolidity/syntaxTests/conversion/function_type_pure_view.sol
@@ -0,0 +1,8 @@
+contract C {
+ function h() pure external {
+ }
+ function f() view external returns (bytes4) {
+ function () view external g = this.h;
+ return g.selector;
+ }
+}
diff --git a/test/libsolidity/syntaxTests/conversion/function_type_same.sol b/test/libsolidity/syntaxTests/conversion/function_type_same.sol
new file mode 100644
index 00000000..c5ebe1ca
--- /dev/null
+++ b/test/libsolidity/syntaxTests/conversion/function_type_same.sol
@@ -0,0 +1,14 @@
+contract C {
+ int dummy;
+ function h_nonpayable() external { dummy = 1; }
+ function h_payable() payable external {}
+ function h_view() view external { dummy; }
+ function h_pure() pure external {}
+ function f() view external {
+ function () external g_nonpayable = this.h_nonpayable; g_nonpayable;
+ function () payable external g_payable = this.h_payable; g_payable;
+ function () view external g_view = this.h_view; g_view;
+ function () pure external g_pure = this.h_pure; g_pure;
+ }
+}
+// ----
diff --git a/test/libsolidity/syntaxTests/conversion/function_type_view_nonpayable.sol b/test/libsolidity/syntaxTests/conversion/function_type_view_nonpayable.sol
new file mode 100644
index 00000000..f52aece0
--- /dev/null
+++ b/test/libsolidity/syntaxTests/conversion/function_type_view_nonpayable.sol
@@ -0,0 +1,10 @@
+contract C {
+ int dummy;
+ function h() view external {
+ dummy;
+ }
+ function f() view external returns (bytes4) {
+ function () external g = this.h;
+ return g.selector;
+ }
+}
diff --git a/test/libsolidity/syntaxTests/conversion/function_type_view_payable.sol b/test/libsolidity/syntaxTests/conversion/function_type_view_payable.sol
new file mode 100644
index 00000000..3bf4bac2
--- /dev/null
+++ b/test/libsolidity/syntaxTests/conversion/function_type_view_payable.sol
@@ -0,0 +1,10 @@
+contract C {
+ function h() view external {
+ }
+ function f() view external returns (bytes4) {
+ function () payable external g = this.h;
+ return g.selector;
+ }
+}
+// ----
+// TypeError: (110-149): Type function () view external is not implicitly convertible to expected type function () payable external.
diff --git a/test/libsolidity/syntaxTests/conversion/function_type_view_pure.sol b/test/libsolidity/syntaxTests/conversion/function_type_view_pure.sol
new file mode 100644
index 00000000..c567a2c8
--- /dev/null
+++ b/test/libsolidity/syntaxTests/conversion/function_type_view_pure.sol
@@ -0,0 +1,10 @@
+contract C {
+ function h() view external {
+ }
+ function f() view external returns (bytes4) {
+ function () pure external g = this.h;
+ return g.selector;
+ }
+}
+// ----
+// TypeError: (110-146): Type function () view external is not implicitly convertible to expected type function () pure external.
diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg.sol
new file mode 100644
index 00000000..e05277de
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg.sol
@@ -0,0 +1,13 @@
+contract C {
+ function f() public pure {
+ assembly {
+ function f(a, b) {}
+ f()
+ f(1,)
+ f(,1)
+ }
+ }
+}
+// ----
+// ParserError: (113-114): Literal, identifier or instruction expected.
+// ParserError: (113-114): Expected primary expression.
diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_function_name.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_function_name.sol
new file mode 100644
index 00000000..17995b09
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_function_name.sol
@@ -0,0 +1,10 @@
+contract C {
+ function f() public pure {
+ assembly {
+ function (a, b) {}
+ }
+ }
+}
+// ----
+// ParserError: (72-73): Expected identifier but got '('
+// ParserError: (79-80): Expected ';' but got '{'
diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol
new file mode 100644
index 00000000..715913de
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol
@@ -0,0 +1,10 @@
+contract C {
+ function f() public pure {
+ assembly {
+ let x := 0100
+ }
+ }
+}
+// ----
+// ParserError: (72-73): Literal, identifier or instruction expected.
+// ParserError: (72-73): Expected primary expression.
diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable_in_assign.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable_in_assign.sol
new file mode 100644
index 00000000..c8984333
--- /dev/null
+++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable_in_assign.sol
@@ -0,0 +1,11 @@
+contract C {
+ function f() public pure {
+ assembly {
+ let x := mload(0)
+ := 1
+ }
+ }
+}
+// ----
+// ParserError: (87-88): Literal, identifier or instruction expected.
+// ParserError: (87-88): Expected primary expression.
diff --git a/test/libsolidity/syntaxTests/types/rational_negative_numerator_negative_exp.sol b/test/libsolidity/syntaxTests/types/rational_negative_numerator_negative_exp.sol
new file mode 100644
index 00000000..b694992c
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/rational_negative_numerator_negative_exp.sol
@@ -0,0 +1,5 @@
+contract C {
+ function f() public pure returns (int) {
+ return (-1 / 2) ** -1;
+ }
+}