diff options
Diffstat (limited to 'test/libsolidity')
47 files changed, 98 insertions, 185 deletions
diff --git a/test/libsolidity/ASTJSON/documentation.json b/test/libsolidity/ASTJSON/documentation.json index 56b748c1..403d4e72 100644 --- a/test/libsolidity/ASTJSON/documentation.json +++ b/test/libsolidity/ASTJSON/documentation.json @@ -148,7 +148,6 @@ "id" : 14, "implemented" : true, "isConstructor" : false, - "isDeclaredConst" : false, "modifiers" : [], "name" : "fn", "nodeType" : "FunctionDefinition", @@ -159,7 +158,6 @@ "parameters" : [], "src" : "145:2:3" }, - "payable" : false, "returnParameters" : { "id" : 12, diff --git a/test/libsolidity/ASTJSON/documentation_legacy.json b/test/libsolidity/ASTJSON/documentation_legacy.json index 44ae537b..5a890e50 100644 --- a/test/libsolidity/ASTJSON/documentation_legacy.json +++ b/test/libsolidity/ASTJSON/documentation_legacy.json @@ -105,7 +105,6 @@ { "attributes" : { - "constant" : false, "documentation" : "Some comment on fn.", "implemented" : true, "isConstructor" : false, @@ -114,7 +113,6 @@ null ], "name" : "fn", - "payable" : false, "scope" : 15, "stateMutability" : "nonpayable", "superFunction" : null, diff --git a/test/libsolidity/ASTJSON/function_type.json b/test/libsolidity/ASTJSON/function_type.json index f0389d17..7b10f0dc 100644 --- a/test/libsolidity/ASTJSON/function_type.json +++ b/test/libsolidity/ASTJSON/function_type.json @@ -38,7 +38,6 @@ "id" : 16, "implemented" : true, "isConstructor" : false, - "isDeclaredConst" : false, "modifiers" : [], "name" : "f", "nodeType" : "FunctionDefinition", @@ -65,7 +64,6 @@ "typeName" : { "id" : 5, - "isDeclaredConst" : false, "nodeType" : "FunctionTypeName", "parameterTypes" : { @@ -74,7 +72,6 @@ "parameters" : [], "src" : "32:2:1" }, - "payable" : true, "returnParameterTypes" : { "id" : 4, @@ -128,7 +125,6 @@ ], "src" : "23:46:1" }, - "payable" : false, "returnParameters" : { "id" : 14, @@ -152,7 +148,6 @@ "typeName" : { "id" : 12, - "isDeclaredConst" : true, "nodeType" : "FunctionTypeName", "parameterTypes" : { @@ -161,7 +156,6 @@ "parameters" : [], "src" : "87:2:1" }, - "payable" : false, "returnParameterTypes" : { "id" : 11, diff --git a/test/libsolidity/ASTJSON/function_type_legacy.json b/test/libsolidity/ASTJSON/function_type_legacy.json index 4db5fb1c..952fd865 100644 --- a/test/libsolidity/ASTJSON/function_type_legacy.json +++ b/test/libsolidity/ASTJSON/function_type_legacy.json @@ -38,7 +38,6 @@ { "attributes" : { - "constant" : false, "documentation" : null, "implemented" : true, "isConstructor" : false, @@ -47,7 +46,6 @@ null ], "name" : "f", - "payable" : false, "scope" : 17, "stateMutability" : "nonpayable", "superFunction" : null, @@ -75,8 +73,6 @@ { "attributes" : { - "constant" : false, - "payable" : true, "stateMutability" : "payable", "type" : "function () payable external returns (uint256)", "visibility" : "external" @@ -168,8 +164,6 @@ { "attributes" : { - "constant" : true, - "payable" : false, "stateMutability" : "view", "type" : "function () view external returns (uint256)", "visibility" : "external" diff --git a/test/libsolidity/ASTJSON/long_type_name_binary_operation.json b/test/libsolidity/ASTJSON/long_type_name_binary_operation.json index 6a956ca4..fe3e73d2 100644 --- a/test/libsolidity/ASTJSON/long_type_name_binary_operation.json +++ b/test/libsolidity/ASTJSON/long_type_name_binary_operation.json @@ -143,7 +143,6 @@ "id" : 10, "implemented" : true, "isConstructor" : false, - "isDeclaredConst" : false, "modifiers" : [], "name" : "f", "nodeType" : "FunctionDefinition", @@ -154,7 +153,6 @@ "parameters" : [], "src" : "23:2:1" }, - "payable" : false, "returnParameters" : { "id" : 2, diff --git a/test/libsolidity/ASTJSON/long_type_name_binary_operation_legacy.json b/test/libsolidity/ASTJSON/long_type_name_binary_operation_legacy.json index cd4eefb1..d78d01ff 100644 --- a/test/libsolidity/ASTJSON/long_type_name_binary_operation_legacy.json +++ b/test/libsolidity/ASTJSON/long_type_name_binary_operation_legacy.json @@ -38,7 +38,6 @@ { "attributes" : { - "constant" : false, "documentation" : null, "implemented" : true, "isConstructor" : false, @@ -47,7 +46,6 @@ null ], "name" : "f", - "payable" : false, "scope" : 11, "stateMutability" : "nonpayable", "superFunction" : null, diff --git a/test/libsolidity/ASTJSON/long_type_name_identifier.json b/test/libsolidity/ASTJSON/long_type_name_identifier.json index b1f8faa2..0579967c 100644 --- a/test/libsolidity/ASTJSON/long_type_name_identifier.json +++ b/test/libsolidity/ASTJSON/long_type_name_identifier.json @@ -149,7 +149,6 @@ "id" : 13, "implemented" : true, "isConstructor" : false, - "isDeclaredConst" : false, "modifiers" : [], "name" : "f", "nodeType" : "FunctionDefinition", @@ -160,7 +159,6 @@ "parameters" : [], "src" : "33:2:1" }, - "payable" : false, "returnParameters" : { "id" : 5, diff --git a/test/libsolidity/ASTJSON/long_type_name_identifier_legacy.json b/test/libsolidity/ASTJSON/long_type_name_identifier_legacy.json index d7739f10..a96ccef3 100644 --- a/test/libsolidity/ASTJSON/long_type_name_identifier_legacy.json +++ b/test/libsolidity/ASTJSON/long_type_name_identifier_legacy.json @@ -80,7 +80,6 @@ { "attributes" : { - "constant" : false, "documentation" : null, "implemented" : true, "isConstructor" : false, @@ -89,7 +88,6 @@ null ], "name" : "f", - "payable" : false, "scope" : 14, "stateMutability" : "nonpayable", "superFunction" : null, diff --git a/test/libsolidity/ASTJSON/modifier_definition.json b/test/libsolidity/ASTJSON/modifier_definition.json index da64b78d..95554f03 100644 --- a/test/libsolidity/ASTJSON/modifier_definition.json +++ b/test/libsolidity/ASTJSON/modifier_definition.json @@ -98,7 +98,6 @@ "id" : 13, "implemented" : true, "isConstructor" : false, - "isDeclaredConst" : false, "modifiers" : [ { @@ -153,7 +152,6 @@ "parameters" : [], "src" : "49:2:1" }, - "payable" : false, "returnParameters" : { "id" : 11, diff --git a/test/libsolidity/ASTJSON/modifier_definition_legacy.json b/test/libsolidity/ASTJSON/modifier_definition_legacy.json index f38d07be..e1e797ba 100644 --- a/test/libsolidity/ASTJSON/modifier_definition_legacy.json +++ b/test/libsolidity/ASTJSON/modifier_definition_legacy.json @@ -102,12 +102,10 @@ { "attributes" : { - "constant" : false, "documentation" : null, "implemented" : true, "isConstructor" : false, "name" : "F", - "payable" : false, "scope" : 14, "stateMutability" : "nonpayable", "superFunction" : null, diff --git a/test/libsolidity/ASTJSON/modifier_invocation.json b/test/libsolidity/ASTJSON/modifier_invocation.json index da64b78d..95554f03 100644 --- a/test/libsolidity/ASTJSON/modifier_invocation.json +++ b/test/libsolidity/ASTJSON/modifier_invocation.json @@ -98,7 +98,6 @@ "id" : 13, "implemented" : true, "isConstructor" : false, - "isDeclaredConst" : false, "modifiers" : [ { @@ -153,7 +152,6 @@ "parameters" : [], "src" : "49:2:1" }, - "payable" : false, "returnParameters" : { "id" : 11, diff --git a/test/libsolidity/ASTJSON/modifier_invocation_legacy.json b/test/libsolidity/ASTJSON/modifier_invocation_legacy.json index f38d07be..e1e797ba 100644 --- a/test/libsolidity/ASTJSON/modifier_invocation_legacy.json +++ b/test/libsolidity/ASTJSON/modifier_invocation_legacy.json @@ -102,12 +102,10 @@ { "attributes" : { - "constant" : false, "documentation" : null, "implemented" : true, "isConstructor" : false, "name" : "F", - "payable" : false, "scope" : 14, "stateMutability" : "nonpayable", "superFunction" : null, diff --git a/test/libsolidity/ASTJSON/non_utf8.json b/test/libsolidity/ASTJSON/non_utf8.json index ec4804f1..307259e9 100644 --- a/test/libsolidity/ASTJSON/non_utf8.json +++ b/test/libsolidity/ASTJSON/non_utf8.json @@ -90,7 +90,6 @@ "id" : 7, "implemented" : true, "isConstructor" : false, - "isDeclaredConst" : false, "modifiers" : [], "name" : "f", "nodeType" : "FunctionDefinition", @@ -101,7 +100,6 @@ "parameters" : [], "src" : "23:2:1" }, - "payable" : false, "returnParameters" : { "id" : 2, diff --git a/test/libsolidity/ASTJSON/non_utf8_legacy.json b/test/libsolidity/ASTJSON/non_utf8_legacy.json index d83d2d97..b1f847f7 100644 --- a/test/libsolidity/ASTJSON/non_utf8_legacy.json +++ b/test/libsolidity/ASTJSON/non_utf8_legacy.json @@ -38,7 +38,6 @@ { "attributes" : { - "constant" : false, "documentation" : null, "implemented" : true, "isConstructor" : false, @@ -47,7 +46,6 @@ null ], "name" : "f", - "payable" : false, "scope" : 8, "stateMutability" : "nonpayable", "superFunction" : null, diff --git a/test/libsolidity/ASTJSON/short_type_name.json b/test/libsolidity/ASTJSON/short_type_name.json index 32df8cde..502c1e31 100644 --- a/test/libsolidity/ASTJSON/short_type_name.json +++ b/test/libsolidity/ASTJSON/short_type_name.json @@ -94,7 +94,6 @@ "id" : 9, "implemented" : true, "isConstructor" : false, - "isDeclaredConst" : false, "modifiers" : [], "name" : "f", "nodeType" : "FunctionDefinition", @@ -105,7 +104,6 @@ "parameters" : [], "src" : "23:2:1" }, - "payable" : false, "returnParameters" : { "id" : 2, diff --git a/test/libsolidity/ASTJSON/short_type_name_legacy.json b/test/libsolidity/ASTJSON/short_type_name_legacy.json index d14954c8..761bcd3b 100644 --- a/test/libsolidity/ASTJSON/short_type_name_legacy.json +++ b/test/libsolidity/ASTJSON/short_type_name_legacy.json @@ -38,7 +38,6 @@ { "attributes" : { - "constant" : false, "documentation" : null, "implemented" : true, "isConstructor" : false, @@ -47,7 +46,6 @@ null ], "name" : "f", - "payable" : false, "scope" : 10, "stateMutability" : "nonpayable", "superFunction" : null, diff --git a/test/libsolidity/ASTJSON/short_type_name_ref.json b/test/libsolidity/ASTJSON/short_type_name_ref.json index ebe940cf..b0c3ad97 100644 --- a/test/libsolidity/ASTJSON/short_type_name_ref.json +++ b/test/libsolidity/ASTJSON/short_type_name_ref.json @@ -106,7 +106,6 @@ "id" : 10, "implemented" : true, "isConstructor" : false, - "isDeclaredConst" : false, "modifiers" : [], "name" : "f", "nodeType" : "FunctionDefinition", @@ -117,7 +116,6 @@ "parameters" : [], "src" : "23:2:1" }, - "payable" : false, "returnParameters" : { "id" : 2, diff --git a/test/libsolidity/ASTJSON/short_type_name_ref_legacy.json b/test/libsolidity/ASTJSON/short_type_name_ref_legacy.json index aaf9b8be..d426a384 100644 --- a/test/libsolidity/ASTJSON/short_type_name_ref_legacy.json +++ b/test/libsolidity/ASTJSON/short_type_name_ref_legacy.json @@ -38,7 +38,6 @@ { "attributes" : { - "constant" : false, "documentation" : null, "implemented" : true, "isConstructor" : false, @@ -47,7 +46,6 @@ null ], "name" : "f", - "payable" : false, "scope" : 11, "stateMutability" : "nonpayable", "superFunction" : null, diff --git a/test/libsolidity/ASTJSON/source_location.json b/test/libsolidity/ASTJSON/source_location.json index bd9290fd..8d8acb0f 100644 --- a/test/libsolidity/ASTJSON/source_location.json +++ b/test/libsolidity/ASTJSON/source_location.json @@ -128,7 +128,6 @@ "id" : 10, "implemented" : true, "isConstructor" : false, - "isDeclaredConst" : false, "modifiers" : [], "name" : "f", "nodeType" : "FunctionDefinition", @@ -139,7 +138,6 @@ "parameters" : [], "src" : "23:2:1" }, - "payable" : false, "returnParameters" : { "id" : 2, diff --git a/test/libsolidity/ASTJSON/source_location_legacy.json b/test/libsolidity/ASTJSON/source_location_legacy.json index d046e6ae..327cd6da 100644 --- a/test/libsolidity/ASTJSON/source_location_legacy.json +++ b/test/libsolidity/ASTJSON/source_location_legacy.json @@ -38,7 +38,6 @@ { "attributes" : { - "constant" : false, "documentation" : null, "implemented" : true, "isConstructor" : false, @@ -47,7 +46,6 @@ null ], "name" : "f", - "payable" : false, "scope" : 11, "stateMutability" : "nonpayable", "superFunction" : null, diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp index 0b2e23e6..fdb11504 100644 --- a/test/libsolidity/SolidityABIJSON.cpp +++ b/test/libsolidity/SolidityABIJSON.cpp @@ -40,7 +40,7 @@ class JSONInterfaceChecker public: JSONInterfaceChecker(): m_compilerStack() {} - void checkInterface(std::string const& _code, std::string const& _expectedInterfaceString) + void checkInterface(std::string const& _code, std::string const& _contractName, std::string const& _expectedInterfaceString) { m_compilerStack.reset(false); m_compilerStack.addSource("", "pragma solidity >=0.0;\n" + _code); @@ -48,7 +48,7 @@ public: m_compilerStack.setOptimiserSettings(dev::test::Options::get().optimize); BOOST_REQUIRE_MESSAGE(m_compilerStack.parseAndAnalyze(), "Parsing contract failed"); - Json::Value generatedInterface = m_compilerStack.contractABI(m_compilerStack.lastContractName()); + Json::Value generatedInterface = m_compilerStack.contractABI(_contractName); Json::Value expectedInterface; BOOST_REQUIRE(jsonParseStrict(_expectedInterfaceString, expectedInterface)); BOOST_CHECK_MESSAGE( @@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE(basic_test) } ])"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(empty_contract) @@ -104,7 +104,7 @@ BOOST_AUTO_TEST_CASE(empty_contract) )"; char const* interface = "[]"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(multiple_methods) @@ -157,7 +157,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods) } ])"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(multiple_params) @@ -194,7 +194,7 @@ BOOST_AUTO_TEST_CASE(multiple_params) } ])"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(multiple_methods_order) @@ -248,7 +248,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods_order) } ])"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(view_function) @@ -303,7 +303,7 @@ BOOST_AUTO_TEST_CASE(view_function) } ])"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(pure_function) @@ -358,7 +358,7 @@ BOOST_AUTO_TEST_CASE(pure_function) } ])"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(events) @@ -436,7 +436,7 @@ BOOST_AUTO_TEST_CASE(events) ])"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(events_anonymous) @@ -456,7 +456,7 @@ BOOST_AUTO_TEST_CASE(events_anonymous) ])"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(inherited) @@ -531,7 +531,7 @@ BOOST_AUTO_TEST_CASE(inherited) }])"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "Derived", interface); } BOOST_AUTO_TEST_CASE(empty_name_input_parameter_with_named_one) { @@ -575,7 +575,7 @@ BOOST_AUTO_TEST_CASE(empty_name_input_parameter_with_named_one) } ])"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(empty_name_return_parameter) @@ -609,7 +609,7 @@ BOOST_AUTO_TEST_CASE(empty_name_return_parameter) ] } ])"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(constructor_abi) @@ -641,7 +641,7 @@ BOOST_AUTO_TEST_CASE(constructor_abi) "type": "constructor" } ])"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(payable_constructor_abi) @@ -673,7 +673,7 @@ BOOST_AUTO_TEST_CASE(payable_constructor_abi) "type": "constructor" } ])"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(return_param_in_abi) @@ -719,7 +719,7 @@ BOOST_AUTO_TEST_CASE(return_param_in_abi) } ] )"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(strings_and_arrays) @@ -748,7 +748,7 @@ BOOST_AUTO_TEST_CASE(strings_and_arrays) } ] )"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(library_function) @@ -780,7 +780,7 @@ BOOST_AUTO_TEST_CASE(library_function) } ] )"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(include_fallback_function) @@ -800,7 +800,7 @@ BOOST_AUTO_TEST_CASE(include_fallback_function) } ] )"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(payable_function) @@ -834,7 +834,7 @@ BOOST_AUTO_TEST_CASE(payable_function) } ] )"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(payable_fallback_function) @@ -854,7 +854,7 @@ BOOST_AUTO_TEST_CASE(payable_fallback_function) } ] )"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(function_type) @@ -881,12 +881,12 @@ BOOST_AUTO_TEST_CASE(function_type) } ] )"; - checkInterface(sourceCode, interface); + checkInterface(sourceCode, "test", interface); } BOOST_AUTO_TEST_CASE(return_structs) { - char const* text = R"( + char const* sourceCode = R"( pragma experimental ABIEncoderV2; contract C { struct S { uint a; T[] sub; } @@ -931,12 +931,12 @@ BOOST_AUTO_TEST_CASE(return_structs) "type" : "function" }] )"; - checkInterface(text, interface); + checkInterface(sourceCode, "C", interface); } BOOST_AUTO_TEST_CASE(return_structs_with_contracts) { - char const* text = R"( + char const* sourceCode = R"( pragma experimental ABIEncoderV2; contract C { struct S { C[] x; C y; } @@ -974,12 +974,12 @@ BOOST_AUTO_TEST_CASE(return_structs_with_contracts) "type": "function" }] )"; - checkInterface(text, interface); + checkInterface(sourceCode, "C", interface); } BOOST_AUTO_TEST_CASE(event_structs) { - char const* text = R"( + char const* sourceCode = R"( pragma experimental ABIEncoderV2; contract C { struct S { uint a; T[] sub; bytes b; } @@ -1032,12 +1032,12 @@ BOOST_AUTO_TEST_CASE(event_structs) "type": "event" }] )"; - checkInterface(text, interface); + checkInterface(sourceCode, "C", interface); } BOOST_AUTO_TEST_CASE(structs_in_libraries) { - char const* text = R"( + char const* sourceCode = R"( pragma experimental ABIEncoderV2; library L { struct S { uint a; T[] sub; bytes b; } @@ -1096,7 +1096,7 @@ BOOST_AUTO_TEST_CASE(structs_in_libraries) "type": "function" }] )"; - checkInterface(text, interface); + checkInterface(sourceCode, "L", interface); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 066e97e6..9c287e5e 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -12489,6 +12489,44 @@ BOOST_AUTO_TEST_CASE(abi_encode_with_signaturev2) ABI_CHECK(callContractFunction("f4()"), expectation); } +BOOST_AUTO_TEST_CASE(abi_encode_empty_string) +{ + char const* sourceCode = R"( + // Tests that this will not end up using a "bytes0" type + // (which would assert) + contract C { + function f() public pure returns (bytes memory, bytes memory) { + return (abi.encode(""), abi.encodePacked("")); + } + } + )"; + compileAndRun(sourceCode, 0, "C"); + ABI_CHECK(callContractFunction("f()"), encodeArgs( + 0x40, 0xc0, + 0x60, 0x20, 0x00, 0x00, + 0x00 + )); +} + +BOOST_AUTO_TEST_CASE(abi_encode_empty_string_v2) +{ + char const* sourceCode = R"( + // Tests that this will not end up using a "bytes0" type + // (which would assert) + pragma experimental ABIEncoderV2; + contract C { + function f() public pure returns (bytes memory, bytes memory) { + return (abi.encode(""), abi.encodePacked("")); + } + } + )"; + compileAndRun(sourceCode, 0, "C"); + ABI_CHECK(callContractFunction("f()"), encodeArgs( + 0x40, 0xa0, + 0x40, 0x20, 0x00, + 0x00 + )); +} BOOST_AUTO_TEST_CASE(abi_encode_call) { char const* sourceCode = R"T( diff --git a/test/libsolidity/syntaxTests/constants/assign_constant_function_value_050.sol b/test/libsolidity/syntaxTests/constants/assign_constant_function_value_050.sol deleted file mode 100644 index 2c92899d..00000000 --- a/test/libsolidity/syntaxTests/constants/assign_constant_function_value_050.sol +++ /dev/null @@ -1,8 +0,0 @@ -pragma experimental "v0.5.0"; - -contract C { - function () pure returns (uint) x; - uint constant y = x(); -} -// ---- -// TypeError: (105-108): Initial value for constant variable has to be compile-time constant. diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor_V050.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor_V050.sol deleted file mode 100644 index 8d5df5bf..00000000 --- a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor_V050.sol +++ /dev/null @@ -1,7 +0,0 @@ -pragma experimental "v0.5.0"; - -contract A { constructor(uint) public { } } -contract B is A(2) { constructor() public { } } -contract C is B { constructor() A(3) public { } } -// ---- -// DeclarationError: (156-160): Base constructor arguments given twice. diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_V050.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_V050.sol deleted file mode 100644 index f9325f99..00000000 --- a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_V050.sol +++ /dev/null @@ -1,6 +0,0 @@ -pragma experimental "v0.5.0"; - -contract A { constructor(uint) public { } } -contract B is A(2) { constructor() A(3) public { } } -// ---- -// DeclarationError: (110-114): Base constructor arguments given twice. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_offset.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_offset.sol new file mode 100644 index 00000000..ec23a263 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_offset.sol @@ -0,0 +1,9 @@ +contract C { + function f() public pure { + assembly { + _offset + } + } +} +// ---- +// DeclarationError: (75-82): In variable names _slot and _offset can only be used as a suffix. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_slot.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_slot.sol new file mode 100644 index 00000000..d493a68a --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_empty_slot.sol @@ -0,0 +1,9 @@ +contract C { + function f() public pure { + assembly { + _slot + } + } +} +// ---- +// DeclarationError: (75-80): In variable names _slot and _offset can only be used as a suffix. diff --git a/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_050.sol b/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_050.sol deleted file mode 100644 index af1babbc..00000000 --- a/test/libsolidity/syntaxTests/modifiers/modifiers_on_abstract_functions_050.sol +++ /dev/null @@ -1,10 +0,0 @@ -pragma experimental "v0.5.0"; -contract C -{ - modifier only_owner() { _; } - function foo() only_owner public; - function bar() public only_owner; -} -// ---- -// SyntaxError: (80-113): Functions without implementation cannot have modifiers. -// SyntaxError: (118-151): Functions without implementation cannot have modifiers. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/166_assigning_state_to_const_variable_050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/166_assigning_state_to_const_variable_050.sol deleted file mode 100644 index dc0a6e63..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/166_assigning_state_to_const_variable_050.sol +++ /dev/null @@ -1,7 +0,0 @@ -pragma experimental "v0.5.0"; - -contract C { - address constant x = msg.sender; -} -// ---- -// TypeError: (69-79): Initial value for constant variable has to be compile-time constant. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/352_callcode_deprecated_v050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/352_callcode_deprecated_v050.sol deleted file mode 100644 index c0e29b38..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/352_callcode_deprecated_v050.sol +++ /dev/null @@ -1,8 +0,0 @@ -pragma experimental "v0.5.0"; -contract test { - function f() pure public { - address(0x12).callcode; - } -} -// ---- -// TypeError: (85-107): "callcode" has been deprecated in favour of "delegatecall". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/375_inline_assembly_unbalanced_two_stack_load.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/375_inline_assembly_unbalanced_two_stack_load.sol index 4cda64e7..ca1e15a9 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/375_inline_assembly_unbalanced_two_stack_load.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/375_inline_assembly_unbalanced_two_stack_load.sol @@ -1,4 +1,3 @@ -pragma experimental "v0.5.0"; contract c { uint8 x; function f() public { @@ -6,4 +5,4 @@ contract c { } } // ---- -// TypeError: (105-106): Only local variables are supported. To access storage variables, use the _slot and _offset suffixes. +// TypeError: (75-76): Only local variables are supported. To access storage variables, use the _slot and _offset suffixes. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/376_inline_assembly_in_modifier.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/376_inline_assembly_in_modifier.sol index d6dcc4d0..0032f99e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/376_inline_assembly_in_modifier.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/376_inline_assembly_in_modifier.sol @@ -1,4 +1,3 @@ -pragma experimental "v0.5.0"; contract test { modifier m { uint a = 1; @@ -11,4 +10,4 @@ contract test { } } // ---- -// Warning: (152-181): Function state mutability can be restricted to pure +// Warning: (122-151): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/377_inline_assembly_storage.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/377_inline_assembly_storage.sol index 9a2065e2..3dfb458a 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/377_inline_assembly_storage.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/377_inline_assembly_storage.sol @@ -1,4 +1,3 @@ -pragma experimental "v0.5.0"; contract test { uint x = 1; function f() public { @@ -8,4 +7,4 @@ contract test { } } // ---- -// TypeError: (119-120): Only local variables are supported. To access storage variables, use the _slot and _offset suffixes. +// TypeError: (89-90): Only local variables are supported. To access storage variables, use the _slot and _offset suffixes. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/378_inline_assembly_storage_in_modifiers.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/378_inline_assembly_storage_in_modifiers.sol index b99179ef..b9b92d47 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/378_inline_assembly_storage_in_modifiers.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/378_inline_assembly_storage_in_modifiers.sol @@ -1,4 +1,3 @@ -pragma experimental "v0.5.0"; contract test { uint x = 1; modifier m { @@ -11,4 +10,4 @@ contract test { } } // ---- -// TypeError: (110-111): Only local variables are supported. To access storage variables, use the _slot and _offset suffixes. +// TypeError: (80-81): Only local variables are supported. To access storage variables, use the _slot and _offset suffixes. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/379_inline_assembly_constant_assign.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/379_inline_assembly_constant_assign.sol index 866232dd..c8928804 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/379_inline_assembly_constant_assign.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/379_inline_assembly_constant_assign.sol @@ -1,4 +1,3 @@ -pragma experimental "v0.5.0"; contract test { uint constant x = 1; function f() public { @@ -8,4 +7,4 @@ contract test { } } // ---- -// TypeError: (128-129): Constant variables not supported by inline assembly. +// TypeError: (98-99): Constant variables not supported by inline assembly. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/380_inline_assembly_constant_access.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/380_inline_assembly_constant_access.sol index a41858a0..03ff9166 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/380_inline_assembly_constant_access.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/380_inline_assembly_constant_access.sol @@ -1,4 +1,3 @@ -pragma experimental "v0.5.0"; contract test { uint constant x = 1; function f() public { @@ -8,4 +7,4 @@ contract test { } } // ---- -// TypeError: (137-138): Constant variables not supported by inline assembly. +// TypeError: (107-108): Constant variables not supported by inline assembly. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/381_inline_assembly_local_variable_access_out_of_functions.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/381_inline_assembly_local_variable_access_out_of_functions.sol index 93004ef6..877f5783 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/381_inline_assembly_local_variable_access_out_of_functions.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/381_inline_assembly_local_variable_access_out_of_functions.sol @@ -1,4 +1,3 @@ -pragma experimental "v0.5.0"; contract test { function f() public { uint a; @@ -8,4 +7,4 @@ contract test { } } // ---- -// DeclarationError: (144-145): Cannot access local Solidity variables from inside an inline assembly function. +// DeclarationError: (114-115): Cannot access local Solidity variables from inside an inline assembly function. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/382_inline_assembly_local_variable_access_out_of_functions_storage_ptr.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/382_inline_assembly_local_variable_access_out_of_functions_storage_ptr.sol index 913ea725..65d614a3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/382_inline_assembly_local_variable_access_out_of_functions_storage_ptr.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/382_inline_assembly_local_variable_access_out_of_functions_storage_ptr.sol @@ -1,4 +1,3 @@ -pragma experimental "v0.5.0"; contract test { uint[] r; function f() public { @@ -9,4 +8,4 @@ contract test { } } // ---- -// DeclarationError: (172-180): Cannot access local Solidity variables from inside an inline assembly function. +// DeclarationError: (142-150): Cannot access local Solidity variables from inside an inline assembly function. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/383_inline_assembly_storage_variable_access_out_of_functions.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/383_inline_assembly_storage_variable_access_out_of_functions.sol index 7528f355..abe9067a 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/383_inline_assembly_storage_variable_access_out_of_functions.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/383_inline_assembly_storage_variable_access_out_of_functions.sol @@ -1,4 +1,3 @@ -pragma experimental "v0.5.0"; contract test { uint a; function f() pure public { diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/385_inline_assembly_calldata_variables.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/385_inline_assembly_calldata_variables.sol index d95fd978..9e324ce1 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/385_inline_assembly_calldata_variables.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/385_inline_assembly_calldata_variables.sol @@ -1,4 +1,3 @@ -pragma experimental "v0.5.0"; contract C { function f(bytes bytesAsCalldata) external { assembly { @@ -7,4 +6,4 @@ contract C { } } // ---- -// TypeError: (132-147): Call data elements cannot be accessed directly. Copy to a local variable first or use "calldataload" or "calldatacopy" with manually determined offsets and sizes. +// TypeError: (102-117): Call data elements cannot be accessed directly. Copy to a local variable first or use "calldataload" or "calldatacopy" with manually determined offsets and sizes. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/392_inline_assembly_050_jump.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/392_inline_assembly_050_jump.sol deleted file mode 100644 index 0c98ada1..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/392_inline_assembly_050_jump.sol +++ /dev/null @@ -1,10 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function f() pure public { - assembly { - jump(2) - } - } -} -// ---- -// SyntaxError: (105-112): Jump instructions and labels are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch", "if" or "for" statements instead. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/394_inline_assembly_050_leave_items_on_stack.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/394_inline_assembly_050_leave_items_on_stack.sol deleted file mode 100644 index f72fe741..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/394_inline_assembly_050_leave_items_on_stack.sol +++ /dev/null @@ -1,11 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function f() pure public { - assembly { - mload(0) - } - } -} -// ---- -// SyntaxError: (105-113): Top-level expressions are not supposed to return values (this expression returns 1 value). Use ``pop()`` or assign them. -// DeclarationError: (91-123): Unbalanced stack at the end of a block: 1 surplus item(s). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/564_events_without_emit_deprecated_v050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/564_events_without_emit_deprecated_v050.sol deleted file mode 100644 index e148d65a..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/564_events_without_emit_deprecated_v050.sol +++ /dev/null @@ -1,9 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - event e(); - function f() public { - e(); - } -} -// ---- -// TypeError: (92-95): Event invocations have to be prefixed by "emit". diff --git a/test/libsolidity/syntaxTests/tupleAssignments/error_fill.sol b/test/libsolidity/syntaxTests/tupleAssignments/error_fill.sol index ae722391..32b381bb 100644 --- a/test/libsolidity/syntaxTests/tupleAssignments/error_fill.sol +++ b/test/libsolidity/syntaxTests/tupleAssignments/error_fill.sol @@ -1,4 +1,3 @@ -pragma experimental "v0.5.0"; contract C { function f() public pure returns (uint, uint, bytes32) { uint a; @@ -8,5 +7,5 @@ contract C { } } // ---- -// TypeError: (133-136): Type tuple(uint256,uint256,bytes32) is not implicitly convertible to expected type tuple(uint256,). -// TypeError: (147-150): Type tuple(uint256,uint256,bytes32) is not implicitly convertible to expected type tuple(,bytes32). +// TypeError: (103-106): Type tuple(uint256,uint256,bytes32) is not implicitly convertible to expected type tuple(uint256,). +// TypeError: (117-120): Type tuple(uint256,uint256,bytes32) is not implicitly convertible to expected type tuple(,bytes32). diff --git a/test/libsolidity/syntaxTests/tupleAssignments/large_component_count.sol b/test/libsolidity/syntaxTests/tupleAssignments/large_component_count.sol index bbf21d7e..f14641cb 100644 --- a/test/libsolidity/syntaxTests/tupleAssignments/large_component_count.sol +++ b/test/libsolidity/syntaxTests/tupleAssignments/large_component_count.sol @@ -1,4 +1,3 @@ -pragma experimental "v0.5.0"; contract C { function g() public pure returns ( uint, diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_external050.sol b/test/libsolidity/syntaxTests/visibility/interface/function_external.sol index 3f0a9aca..ed409e58 100644 --- a/test/libsolidity/syntaxTests/visibility/interface/function_external050.sol +++ b/test/libsolidity/syntaxTests/visibility/interface/function_external.sol @@ -1,4 +1,3 @@ -pragma experimental "v0.5.0"; interface I { function f() external; } diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_public050.sol b/test/libsolidity/syntaxTests/visibility/interface/function_public050.sol deleted file mode 100644 index e0c04095..00000000 --- a/test/libsolidity/syntaxTests/visibility/interface/function_public050.sol +++ /dev/null @@ -1,6 +0,0 @@ -pragma experimental "v0.5.0"; -interface I { - function f() public; -} -// ---- -// TypeError: (45-65): Functions in interfaces must be declared external. |