From 8b7f87eed5710e19116acd665dda07e6048c8bb6 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Fri, 17 Apr 2020 22:24:33 +0200 Subject: [PATCH] [isoltest] Enforcing compileViaYul to be set if test can pass via yul --- .circleci/config.yml | 18 ++ test/Common.cpp | 1 + test/Common.h | 1 + test/TestCase.cpp | 5 + test/TestCase.h | 3 + test/boostTest.cpp | 11 +- test/libsolidity/SemanticTest.cpp | 236 +++++++++++------- test/libsolidity/SemanticTest.h | 7 +- ...data_array_dynamic_static_short_decode.sol | 2 + .../abiEncoderV2/cleanup/address.sol | 2 + .../abiEncoderV2/cleanup/bool.sol | 2 + .../abiEncoderV2/cleanup/bytesx.sol | 2 + .../abiEncoderV2/cleanup/intx.sol | 2 + .../abiEncoderV2/cleanup/uintx.sol | 2 + .../arithmetics/divisiod_by_zero.sol | 3 +- .../semanticTests/array/array_pop.sol | 3 +- .../array/array_pop_empty_exception.sol | 3 +- .../array/array_pop_isolated.sol | 3 +- .../semanticTests/array/array_push.sol | 3 +- .../array/byte_array_pop_empty_exception.sol | 1 - .../array/byte_array_pop_isolated.sol | 3 +- .../semanticTests/array/calldata_array.sol | 3 +- .../array/calldata_array_dynamic_invalid.sol | 3 +- ...ta_array_dynamic_invalid_static_middle.sol | 3 +- .../create_dynamic_array_with_zero_length.sol | 3 +- .../array/create_multiple_dynamic_arrays.sol | 3 +- .../evm_exceptions_out_of_band_access.sol | 3 +- .../array/fixed_arrays_in_constructors.sol | 3 +- .../array/fixed_bytes_length_access.sol | 3 +- .../memory_arrays_index_access_write.sol | 2 + .../array/memory_arrays_of_various_sizes.sol | 3 +- .../semanticTests/array/push_no_args_1d.sol | 2 + .../cleanup/bool_conversion_v2.sol | 2 + .../cleanup/cleanup_address_types_v2.sol | 2 + .../cleanup/cleanup_bytes_types_v2.sol | 2 + .../cleanup/cleanup_in_compound_assign.sol | 3 +- .../base_constructor_arguments.sol | 2 + .../constructor_arguments_external.sol | 3 +- ...unction_usage_in_constructor_arguments.sol | 2 + ...r_init_inheritence_without_constructor.sol | 3 +- ...conditional_expression_different_types.sol | 2 + .../conditional_expression_false_literal.sol | 2 + .../conditional_expression_functions.sol | 2 + .../conditional_expression_multiple.sol | 2 + .../conditional_expression_true_literal.sol | 2 + .../conditional_expression_tuples.sol | 2 + ...ditional_expression_with_return_values.sol | 2 + .../fallback/fallback_or_receive.sol | 2 + .../semanticTests/fallback/inherited.sol | 2 + .../fallback/short_data_calls_fallback.sol | 2 + .../array_multiple_local_vars.sol | 2 + .../functionCall/call_unimplemented_base.sol | 2 + .../calling_uninitialized_function.sol | 3 +- ...g_uninitialized_function_through_array.sol | 3 +- .../mapping_array_internal_argument.sol | 2 + .../mapping_internal_argument.sol | 2 + .../functionCall/multiple_functions.sol | 1 + .../semanticTests/functionCall/named_args.sol | 2 + .../functionCall/send_zero_ether.sol | 2 + .../functionCall/transaction_status.sol | 2 + .../semanticTests/functionCall/value_test.sol | 2 + .../pass_function_types_internally.sol | 3 +- ...e_function_in_construction_and_runtime.sol | 3 +- .../immutable/multi_creation.sol | 2 + .../inline_assembly_storage_access.sol | 3 +- ...ssembly_storage_access_inside_function.sol | 3 +- .../semanticTests/inlineAssembly/leave.sol | 2 + .../interfaceID/homer_interfaceId.sol | 2 + .../interfaceID/lisa_interfaceId.sol | 2 + .../inherited_function_calldata_memory.sol | 3 +- .../pass_dynamic_arguments_to_the_base.sol | 2 + ...ass_dynamic_arguments_to_the_base_base.sol | 2 + ...ic_arguments_to_the_base_base_with_gap.sol | 2 + .../library_enum_as_an_expression.sol | 2 + .../library_struct_as_an_expression.sol | 2 + .../literals/hex_string_with_underscore.sol | 2 + .../modifiers/break_in_modifier.sol | 3 +- .../stacked_return_with_modifiers.sol | 3 +- .../receive/empty_calldata_calls_receive.sol | 2 + .../semanticTests/receive/ether_and_data.sol | 2 + .../semanticTests/receive/inherited.sol | 2 + .../revertStrings/array_slices.sol | 1 + .../calldata_array_dynamic_invalid.sol | 1 + ...data_array_dynamic_static_short_decode.sol | 1 + ...ta_array_dynamic_static_short_reencode.sol | 1 + .../calldata_array_invalid_length.sol | 1 + .../calldata_arrays_too_large.sol | 1 + .../revertStrings/calldata_tail_short.sol | 1 + .../revertStrings/short_input_array.sol | 1 + .../revertStrings/short_input_bytes.sol | 1 + .../reverts/invalid_enum_as_external_arg.sol | 3 +- .../semanticTests/reverts/revert.sol | 2 + .../semanticTests/reverts/simple_throw.sol | 2 + .../salted_create_with_value.sol | 1 + .../shifts/shift_constant_left.sol | 3 +- .../shifts/shift_constant_right.sol | 3 +- .../shifts/shift_negative_constant_left.sol | 3 +- .../shifts/shift_negative_constant_right.sol | 3 +- .../semanticTests/smoke/bytes_and_strings.sol | 2 + .../semanticTests/smoke/constructor.sol | 2 + .../abi_functions_member_access.sol | 2 + .../storage/complex_accessors.sol | 2 + .../semanticTests/storage/simple_accessor.sol | 2 + .../semanticTests/tryCatch/assert.sol | 2 + .../semanticTests/tryCatch/trivial.sol | 2 + .../types/assign_calldata_value_type.sol | 2 + .../types/external_function_to_address.sol | 2 + .../types/mapping_contract_key_getter.sol | 2 + .../types/mapping_enum_key_getter_v2.sol | 2 + .../types/packing_signed_types.sol | 2 + .../types/packing_unpacking_types.sol | 2 + .../variables/mapping_local_assignment.sol | 2 + .../mapping_local_compound_assignment.sol | 2 + .../variables/public_state_overridding.sol | 4 +- .../semanticTests/various/decayed_tuple.sol | 3 +- .../various/inline_member_init.sol | 3 +- .../inline_member_init_inheritence.sol | 3 +- .../various/literal_empty_string.sol | 2 + .../various/multi_variable_declaration.sol | 3 +- .../various/positive_integers_to_signed.sol | 3 +- .../various/skip_dynamic_types.sol | 3 +- ...string_as_mapping_key_without_variable.sol | 3 +- .../semanticTests/various/string_tuples.sol | 3 +- .../various/test_underscore_in_hex.sol | 2 + .../semanticTests/various/tuples.sol | 3 +- ...unction_usage_in_constructor_arguments.sol | 2 + test/tools/isoltest.cpp | 8 +- 127 files changed, 412 insertions(+), 145 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 063e11bb5..e1161e432 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -617,6 +617,23 @@ jobs: t_ubu_soltest: &t_ubu_soltest <<: *test_ubuntu1904 + t_ubu_soltest_enforce_yul: &t_ubu_soltest_enforce_yul + docker: + - image: ethereum/solidity-buildpack-deps:ubuntu1904-<< pipeline.parameters.ubuntu-1904-docker-image-rev >> + environment: + EVM: constantinople + SOLTEST_FLAGS: --enforce-via-yul + OPTIMIZE: 0 + TERM: xterm + steps: + - checkout + - attach_workspace: + at: build + - run: *run_soltest + - store_test_results: *store_test_results + - store_artifacts: *artifacts_test_results + + t_ubu_clang_soltest: &t_ubu_clang_soltest <<: *test_ubuntu1904_clang environment: @@ -818,6 +835,7 @@ workflows: - b_ubu18: *workflow_trigger_on_tags - t_ubu_cli: *workflow_ubuntu1904 - t_ubu_soltest: *workflow_ubuntu1904 + - t_ubu_soltest_enforce_yul: *workflow_ubuntu1904 - b_ubu_clang: *workflow_trigger_on_tags - t_ubu_clang_soltest: *workflow_ubuntu1904_clang diff --git a/test/Common.cpp b/test/Common.cpp index 0ed7c9881..b65555ba1 100644 --- a/test/Common.cpp +++ b/test/Common.cpp @@ -95,6 +95,7 @@ CommonOptions::CommonOptions(std::string _caption): ("no-smt", po::bool_switch(&disableSMT), "disable SMT checker") ("optimize", po::bool_switch(&optimize), "enables optimization") ("optimize-yul", po::bool_switch(&optimizeYul), "enables Yul optimization") + ("enforce-via-yul", po::bool_switch(&enforceViaYul), "Enforce compiling all tests via yul to see if additional tests can be activated.") ("abiencoderv2", po::bool_switch(&useABIEncoderV2), "enables abi encoder v2") ("show-messages", po::bool_switch(&showMessages), "enables message output") ("show-metadata", po::bool_switch(&showMetadata), "enables metadata output"); diff --git a/test/Common.h b/test/Common.h index 513e7154b..128d23ee5 100644 --- a/test/Common.h +++ b/test/Common.h @@ -47,6 +47,7 @@ struct CommonOptions: boost::noncopyable boost::filesystem::path testPath; bool optimize = false; bool optimizeYul = false; + bool enforceViaYul = false; bool disableSMT = false; bool useABIEncoderV2 = false; bool showMessages = false; diff --git a/test/TestCase.cpp b/test/TestCase.cpp index e0897ae47..23f23ac73 100644 --- a/test/TestCase.cpp +++ b/test/TestCase.cpp @@ -40,6 +40,11 @@ void TestCase::printSettings(ostream& _stream, const string& _linePrefix, const _stream << _linePrefix << "// " << setting.first << ": " << setting.second << endl; } +void TestCase::printUpdatedSettings(std::ostream& _stream, std::string const& _linePrefix) +{ + printSettings(_stream, _linePrefix); +} + bool TestCase::isTestFilename(boost::filesystem::path const& _filename) { string extension = _filename.extension().string(); diff --git a/test/TestCase.h b/test/TestCase.h index 8ec3086fe..442b4fd5f 100644 --- a/test/TestCase.h +++ b/test/TestCase.h @@ -38,6 +38,7 @@ public: { std::string filename; langutil::EVMVersion evmVersion; + bool enforceCompileViaYul; }; enum class TestResult { Success, Failure, FatalError }; @@ -59,6 +60,8 @@ public: virtual void printSource(std::ostream &_stream, std::string const &_linePrefix = "", bool const _formatted = false) const = 0; /// Outputs settings. virtual void printSettings(std::ostream &_stream, std::string const &_linePrefix = "", bool const _formatted = false); + /// Outputs updated settings + virtual void printUpdatedSettings(std::ostream& _stream, std::string const& _linePrefix = ""); /// Outputs test expectations to @arg _stream that match the actual results of the test. /// Each line of output is prefixed with @arg _linePrefix. virtual void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const = 0; diff --git a/test/boostTest.cpp b/test/boostTest.cpp index fd7bca132..eb55ead89 100644 --- a/test/boostTest.cpp +++ b/test/boostTest.cpp @@ -64,12 +64,13 @@ int registerTests( boost::unit_test::test_suite& _suite, boost::filesystem::path const& _basepath, boost::filesystem::path const& _path, + bool _enforceViaYul, TestCase::TestCaseCreator _testCaseCreator ) { int numTestsAdded = 0; fs::path fullpath = _basepath / _path; - TestCase::Config config{fullpath.string(), solidity::test::CommonOptions::get().evmVersion()}; + TestCase::Config config{fullpath.string(), solidity::test::CommonOptions::get().evmVersion(), _enforceViaYul}; if (fs::is_directory(fullpath)) { test_suite* sub_suite = BOOST_TEST_SUITE(_path.filename().string()); @@ -78,7 +79,12 @@ int registerTests( fs::directory_iterator() )) if (fs::is_directory(entry.path()) || TestCase::isTestFilename(entry.path().filename())) - numTestsAdded += registerTests(*sub_suite, _basepath, _path / entry.path().filename(), _testCaseCreator); + numTestsAdded += registerTests( + *sub_suite, + _basepath, _path / entry.path().filename(), + _enforceViaYul, + _testCaseCreator + ); _suite.add(sub_suite); } else @@ -164,6 +170,7 @@ test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] ) master, options.testPath / ts.path, ts.subpath, + options.enforceViaYul, ts.testCaseCreator ) > 0, std::string("no ") + ts.title + " tests found"); } diff --git a/test/libsolidity/SemanticTest.cpp b/test/libsolidity/SemanticTest.cpp index ded01f8dd..ab454cb28 100644 --- a/test/libsolidity/SemanticTest.cpp +++ b/test/libsolidity/SemanticTest.cpp @@ -36,9 +36,10 @@ using namespace boost::unit_test; namespace fs = boost::filesystem; -SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVersion): +SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVersion, bool enforceViaYul): SolidityExecutionFramework(_evmVersion), - EVMVersionRestrictedTestCase(_filename) + EVMVersionRestrictedTestCase(_filename), + m_enforceViaYul(enforceViaYul) { m_source = m_reader.source(); m_lineOffset = m_reader.lineNumber(); @@ -78,112 +79,145 @@ SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVer TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePrefix, bool _formatted) { - for(bool compileViaYul: set{!m_runWithoutYul, m_runWithYul}) + + for (bool compileViaYul: set{!m_runWithoutYul, m_runWithYul || m_enforceViaYul}) { - reset(); - bool success = true; - - m_compileViaYul = compileViaYul; - if (compileViaYul) - AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Running via Yul:" << endl; - - for (auto& test: m_tests) - test.reset(); - - map libraries; - - bool constructed = false; - - for (auto& test: m_tests) + try { - if (constructed) - { - soltestAssert(!test.call().isLibrary, "Libraries have to be deployed before any other call."); - soltestAssert(!test.call().isConstructor, "Constructor has to be the first function call expect for library deployments."); - } - else if (test.call().isLibrary) - { - soltestAssert( - deploy(test.call().signature, 0, {}, libraries) && m_transactionSuccessful, - "Failed to deploy library " + test.call().signature - ); - libraries[test.call().signature] = m_contractAddress; - continue; - } - else - { - if (test.call().isConstructor) - deploy("", test.call().value.value, test.call().arguments.rawBytes(), libraries); - else - soltestAssert(deploy("", 0, bytes(), libraries), "Failed to deploy contract."); - constructed = true; - } + reset(); + bool success = true; - if (test.call().isConstructor) - { - if (m_transactionSuccessful == test.call().expectations.failure) - success = false; + m_compileViaYul = compileViaYul; + m_compileViaYulCanBeSet = false; - test.setFailure(!m_transactionSuccessful); - test.setRawBytes(bytes()); - } - else + if (compileViaYul) + AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Running via Yul:" << endl; + + for (auto& test: m_tests) + test.reset(); + + map libraries; + + bool constructed = false; + + for (auto& test: m_tests) { - bytes output; - if (test.call().useCallWithoutSignature) - output = callLowLevel(test.call().arguments.rawBytes(), test.call().value.value); - else + if (constructed) + { + soltestAssert(!test.call().isLibrary, "Libraries have to be deployed before any other call."); + soltestAssert(!test.call().isConstructor, "Constructor has to be the first function call expect for library deployments."); + } + else if (test.call().isLibrary) { soltestAssert( - m_allowNonExistingFunctions || m_compiler.methodIdentifiers(m_compiler.lastContractName()).isMember(test.call().signature), - "The function " + test.call().signature + " is not known to the compiler" - ); - - output = callContractFunctionWithValueNoEncoding( - test.call().signature, - test.call().value.value, - test.call().arguments.rawBytes() + deploy(test.call().signature, 0, {}, libraries) && m_transactionSuccessful, + "Failed to deploy library " + test.call().signature ); + libraries[test.call().signature] = m_contractAddress; + continue; + } + else + { + if (test.call().isConstructor) + deploy("", test.call().value.value, test.call().arguments.rawBytes(), libraries); + else + soltestAssert(deploy("", 0, bytes(), libraries), "Failed to deploy contract."); + constructed = true; } - if ((m_transactionSuccessful == test.call().expectations.failure) || (output != test.call().expectations.rawBytes())) - success = false; + if (test.call().isConstructor) + { + if (m_transactionSuccessful == test.call().expectations.failure) + success = false; - test.setFailure(!m_transactionSuccessful); - test.setRawBytes(std::move(output)); - test.setContractABI(m_compiler.contractABI(m_compiler.lastContractName())); + test.setFailure(!m_transactionSuccessful); + test.setRawBytes(bytes()); + } + else + { + bytes output; + if (test.call().useCallWithoutSignature) + output = callLowLevel(test.call().arguments.rawBytes(), test.call().value.value); + else + { + soltestAssert( + m_allowNonExistingFunctions || m_compiler.methodIdentifiers(m_compiler.lastContractName()).isMember(test.call().signature), + "The function " + test.call().signature + " is not known to the compiler" + ); + + output = callContractFunctionWithValueNoEncoding( + test.call().signature, + test.call().value.value, + test.call().arguments.rawBytes() + ); + } + + if ((m_transactionSuccessful == test.call().expectations.failure) || (output != test.call().expectations.rawBytes())) + success = false; + + test.setFailure(!m_transactionSuccessful); + test.setRawBytes(std::move(output)); + test.setContractABI(m_compiler.contractABI(m_compiler.lastContractName())); + } + } + + if (success && !m_runWithYul && compileViaYul) + { + m_compileViaYulCanBeSet = true; + AnsiColorized(_stream, _formatted, {BOLD, YELLOW}) << _linePrefix << endl << _linePrefix + << "Test can pass via Yul and marked with compileViaYul: false." << endl; + return TestResult::Failure; + } + + if (!success && (m_runWithYul || !compileViaYul)) + { + AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Expected result:" << endl; + for (auto const& test: m_tests) + { + ErrorReporter errorReporter; + _stream << test.format(errorReporter, _linePrefix, false, _formatted) << endl; + _stream << errorReporter.format(_linePrefix, _formatted); + } + _stream << endl; + AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Obtained result:" << endl; + for (auto const& test: m_tests) + { + ErrorReporter errorReporter; + _stream << test.format(errorReporter, _linePrefix, true, _formatted) << endl; + _stream << errorReporter.format(_linePrefix, _formatted); + } + AnsiColorized(_stream, _formatted, {BOLD, RED}) << _linePrefix << endl << _linePrefix + << "Attention: Updates on the test will apply the detected format displayed." << endl; + if (compileViaYul && m_runWithoutYul) + { + _stream << _linePrefix << endl << _linePrefix; + AnsiColorized(_stream, _formatted, {RED_BACKGROUND}) + << "Note that the test passed without Yul."; + _stream << endl; + } + else if (!compileViaYul && m_runWithYul) + AnsiColorized(_stream, _formatted, {BOLD, YELLOW}) << _linePrefix << endl << _linePrefix + << "Note that the test also has to pass via Yul." << endl; + return TestResult::Failure; } } - - if (!success) + catch (boost::exception const&) { - AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Expected result:" << endl; - for (auto const& test: m_tests) - { - ErrorReporter errorReporter; - _stream << test.format(errorReporter, _linePrefix, false, _formatted) << endl; - _stream << errorReporter.format(_linePrefix, _formatted); - } - _stream << endl; - AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Obtained result:" << endl; - for (auto const& test: m_tests) - { - ErrorReporter errorReporter; - _stream << test.format(errorReporter, _linePrefix, true, _formatted) << endl; - _stream << errorReporter.format(_linePrefix, _formatted); - } - AnsiColorized(_stream, _formatted, {BOLD, RED}) << _linePrefix << endl << _linePrefix - << "Attention: Updates on the test will apply the detected format displayed." << endl; - if (compileViaYul && m_runWithoutYul) - { - _stream << _linePrefix << endl << _linePrefix; - AnsiColorized(_stream, _formatted, {RED_BACKGROUND}) << "Note that the test passed without Yul."; - _stream << endl; - } - else if (!compileViaYul && m_runWithYul) - AnsiColorized(_stream, _formatted, {BOLD, YELLOW}) << _linePrefix << endl << _linePrefix - << "Note that the test also has to pass via Yul." << endl; - return TestResult::Failure; + if (compileViaYul && !m_runWithYul) + continue; + throw; + } + catch (std::exception const&) + { + if (compileViaYul && !m_runWithYul) + continue; + throw; + } + catch (...) + { + if (compileViaYul && !m_runWithYul) + continue; + throw; } } @@ -204,6 +238,20 @@ void SemanticTest::printUpdatedExpectations(ostream& _stream, string const&) con _stream << test.format("", true, false) << endl; } +void SemanticTest::printUpdatedSettings(ostream& _stream, string const& _linePrefix) +{ + auto& settings = m_reader.settings(); + if (settings.empty() && !m_compileViaYulCanBeSet) + return; + + _stream << _linePrefix << "// ====" << endl; + if (m_compileViaYulCanBeSet) + _stream << _linePrefix << "// compileViaYul: also\n"; + for (auto const& setting: settings) + if (!m_compileViaYulCanBeSet || setting.first != "compileViaYul") + _stream << _linePrefix << "// " << setting.first << ": " << setting.second << endl; +} + void SemanticTest::parseExpectations(istream& _stream) { TestFileParser parser{_stream}; diff --git a/test/libsolidity/SemanticTest.h b/test/libsolidity/SemanticTest.h index 94c29e193..870d61d56 100644 --- a/test/libsolidity/SemanticTest.h +++ b/test/libsolidity/SemanticTest.h @@ -40,13 +40,14 @@ class SemanticTest: public SolidityExecutionFramework, public EVMVersionRestrict { public: static std::unique_ptr create(Config const& _options) - { return std::make_unique(_options.filename, _options.evmVersion); } + { return std::make_unique(_options.filename, _options.evmVersion, _options.enforceCompileViaYul); } - explicit SemanticTest(std::string const& _filename, langutil::EVMVersion _evmVersion); + explicit SemanticTest(std::string const& _filename, langutil::EVMVersion _evmVersion, bool _enforceViaYul = false); TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool _formatted = false) override; void printSource(std::ostream &_stream, std::string const& _linePrefix = "", bool _formatted = false) const override; void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix = "") const override; + void printUpdatedSettings(std::ostream& _stream, std::string const& _linePrefix = "") override; /// Instantiates a test file parser that parses the additional comment section at the end of /// the input stream \param _stream. Each function call is represented using a `FunctionCallTest` @@ -64,8 +65,10 @@ private: std::vector m_tests; bool m_runWithYul = false; bool m_runWithoutYul = true; + bool m_enforceViaYul = false; bool m_runWithABIEncoderV1Only = false; bool m_allowNonExistingFunctions = false; + bool m_compileViaYulCanBeSet = false; }; } diff --git a/test/libsolidity/semanticTests/abiEncoderV2/calldata_array_dynamic_static_short_decode.sol b/test/libsolidity/semanticTests/abiEncoderV2/calldata_array_dynamic_static_short_decode.sol index a89b6336a..0ded29feb 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/calldata_array_dynamic_static_short_decode.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/calldata_array_dynamic_static_short_decode.sol @@ -5,6 +5,8 @@ contract C { return 23; } } +// ==== +// compileViaYul: also // ---- // f(uint256[][2][]): 0x20, 0x01, 0x20, 0x40, 0x60, 0x00, 0x00 -> 23 # this is the common encoding for x.length == 1 && x[0][0].length == 0 && x[0][1].length == 0 # // f(uint256[][2][]): 0x20, 0x01, 0x20, 0x00, 0x00 -> 23 # exotic, but still valid encoding # diff --git a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/address.sol b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/address.sol index 4bd9c2f77..efb5045fc 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/address.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/address.sol @@ -10,6 +10,8 @@ contract C { return this.g(x); } } +// ==== +// compileViaYul: also // ---- // f(uint256): 0 -> 0 // g(address): 0 -> 0 # test validation as well as sanity check # diff --git a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/bool.sol b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/bool.sol index 94d4dbb11..eb9ce5962 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/bool.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/bool.sol @@ -10,6 +10,8 @@ contract C { return this.gggg(x); } } +// ==== +// compileViaYul: also // ---- // f(uint256): 0 -> false // gggg(bool): 0 -> false # test validation as well as sanity check # diff --git a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/bytesx.sol b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/bytesx.sol index f8824e271..294a666e9 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/bytesx.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/bytesx.sol @@ -42,6 +42,8 @@ contract C { return this.g16(x); } } +// ==== +// compileViaYul: also // ---- // f1(bytes32): left(0) -> left(0) // gg1(bytes1): left(0) -> left(0) # test validation as well as sanity check # diff --git a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/intx.sol b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/intx.sol index 51ecd3432..15cd07d49 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/intx.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/intx.sol @@ -42,6 +42,8 @@ contract C { return this.g128(x); } } +// ==== +// compileViaYul: also // ---- // f8(int256): 0 -> 0 // ggg8(int8): 0 -> 0 # test validation as well as sanity check # diff --git a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/uintx.sol b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/uintx.sol index ee0ec362e..9788431e1 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/uintx.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/uintx.sol @@ -42,6 +42,8 @@ contract C { return this.g128(x); } } +// ==== +// compileViaYul: also // ---- // f8(uint256): 0 -> 0 // ggg8(uint8): 0 -> 0 # test validation as well as sanity check # diff --git a/test/libsolidity/semanticTests/arithmetics/divisiod_by_zero.sol b/test/libsolidity/semanticTests/arithmetics/divisiod_by_zero.sol index 127320fc6..0ccc0acb5 100644 --- a/test/libsolidity/semanticTests/arithmetics/divisiod_by_zero.sol +++ b/test/libsolidity/semanticTests/arithmetics/divisiod_by_zero.sol @@ -7,7 +7,8 @@ contract C { return a % b; } } - +// ==== +// compileViaYul: also // ---- // div(uint256,uint256): 7, 2 -> 3 // div(uint256,uint256): 7, 0 -> FAILURE # throws # diff --git a/test/libsolidity/semanticTests/array/array_pop.sol b/test/libsolidity/semanticTests/array/array_pop.sol index 5667b61d4..9e64119e9 100644 --- a/test/libsolidity/semanticTests/array/array_pop.sol +++ b/test/libsolidity/semanticTests/array/array_pop.sol @@ -11,6 +11,7 @@ contract c { l = data.length; } } - +// ==== +// compileViaYul: also // ---- // test() -> 1, 0 diff --git a/test/libsolidity/semanticTests/array/array_pop_empty_exception.sol b/test/libsolidity/semanticTests/array/array_pop_empty_exception.sol index 8fc018d72..9f436d2d2 100644 --- a/test/libsolidity/semanticTests/array/array_pop_empty_exception.sol +++ b/test/libsolidity/semanticTests/array/array_pop_empty_exception.sol @@ -6,6 +6,7 @@ contract c { return true; } } - +// ==== +// compileViaYul: also // ---- // test() -> FAILURE diff --git a/test/libsolidity/semanticTests/array/array_pop_isolated.sol b/test/libsolidity/semanticTests/array/array_pop_isolated.sol index 2e6eac83e..58c56adc9 100644 --- a/test/libsolidity/semanticTests/array/array_pop_isolated.sol +++ b/test/libsolidity/semanticTests/array/array_pop_isolated.sol @@ -8,6 +8,7 @@ contract c { x = 3; } } - +// ==== +// compileViaYul: also // ---- // test() -> 3 diff --git a/test/libsolidity/semanticTests/array/array_push.sol b/test/libsolidity/semanticTests/array/array_push.sol index bd8200a37..5923580fa 100644 --- a/test/libsolidity/semanticTests/array/array_push.sol +++ b/test/libsolidity/semanticTests/array/array_push.sol @@ -14,6 +14,7 @@ contract c { z = data[2]; } } - +// ==== +// compileViaYul: also // ---- // test() -> 5, 4, 3, 3 diff --git a/test/libsolidity/semanticTests/array/byte_array_pop_empty_exception.sol b/test/libsolidity/semanticTests/array/byte_array_pop_empty_exception.sol index 30ffa3a4c..08aea4254 100644 --- a/test/libsolidity/semanticTests/array/byte_array_pop_empty_exception.sol +++ b/test/libsolidity/semanticTests/array/byte_array_pop_empty_exception.sol @@ -9,6 +9,5 @@ contract c { return true; } } - // ---- // test() -> FAILURE diff --git a/test/libsolidity/semanticTests/array/byte_array_pop_isolated.sol b/test/libsolidity/semanticTests/array/byte_array_pop_isolated.sol index a9e3fd383..1635071c5 100644 --- a/test/libsolidity/semanticTests/array/byte_array_pop_isolated.sol +++ b/test/libsolidity/semanticTests/array/byte_array_pop_isolated.sol @@ -8,6 +8,7 @@ contract c { x = 3; } } - +// ==== +// compileViaYul: also // ---- // test() -> 3 diff --git a/test/libsolidity/semanticTests/array/calldata_array.sol b/test/libsolidity/semanticTests/array/calldata_array.sol index c9c6dbda0..9fdd8b44b 100644 --- a/test/libsolidity/semanticTests/array/calldata_array.sol +++ b/test/libsolidity/semanticTests/array/calldata_array.sol @@ -11,6 +11,7 @@ contract C { b = s[1]; } } - +// ==== +// compileViaYul: also // ---- // f(uint256[2]): 42, 23 -> 42, 23 diff --git a/test/libsolidity/semanticTests/array/calldata_array_dynamic_invalid.sol b/test/libsolidity/semanticTests/array/calldata_array_dynamic_invalid.sol index d643d3973..cab938d6c 100644 --- a/test/libsolidity/semanticTests/array/calldata_array_dynamic_invalid.sol +++ b/test/libsolidity/semanticTests/array/calldata_array_dynamic_invalid.sol @@ -11,7 +11,8 @@ contract C { return 42; } } - +// ==== +// compileViaYul: also // ---- // f(uint256[][]): 0x20, 0x0 -> 42 # valid access stub # // f(uint256[][]): 0x20, 0x1 -> FAILURE # invalid on argument decoding # diff --git a/test/libsolidity/semanticTests/array/calldata_array_dynamic_invalid_static_middle.sol b/test/libsolidity/semanticTests/array/calldata_array_dynamic_invalid_static_middle.sol index 3efd177b2..d4c02df5e 100644 --- a/test/libsolidity/semanticTests/array/calldata_array_dynamic_invalid_static_middle.sol +++ b/test/libsolidity/semanticTests/array/calldata_array_dynamic_invalid_static_middle.sol @@ -16,7 +16,8 @@ contract C { return 42; } } - +// ==== +// compileViaYul: also // ---- // f(uint256[][1][]): 0x20, 0x0 -> 42 # valid access stub # // f(uint256[][1][]): 0x20, 0x1 -> FAILURE # invalid on argument decoding # diff --git a/test/libsolidity/semanticTests/array/create_dynamic_array_with_zero_length.sol b/test/libsolidity/semanticTests/array/create_dynamic_array_with_zero_length.sol index 7c2ccde6e..a529a767d 100644 --- a/test/libsolidity/semanticTests/array/create_dynamic_array_with_zero_length.sol +++ b/test/libsolidity/semanticTests/array/create_dynamic_array_with_zero_length.sol @@ -4,6 +4,7 @@ contract C { return 7; } } - +// ==== +// compileViaYul: also // ---- // f() -> 7 diff --git a/test/libsolidity/semanticTests/array/create_multiple_dynamic_arrays.sol b/test/libsolidity/semanticTests/array/create_multiple_dynamic_arrays.sol index 731fb4312..9e57f251c 100644 --- a/test/libsolidity/semanticTests/array/create_multiple_dynamic_arrays.sol +++ b/test/libsolidity/semanticTests/array/create_multiple_dynamic_arrays.sol @@ -29,6 +29,7 @@ contract C { return 0; } } - +// ==== +// compileViaYul: also // ---- // f() -> 7 diff --git a/test/libsolidity/semanticTests/array/evm_exceptions_out_of_band_access.sol b/test/libsolidity/semanticTests/array/evm_exceptions_out_of_band_access.sol index af14b48b4..2ac334c17 100644 --- a/test/libsolidity/semanticTests/array/evm_exceptions_out_of_band_access.sol +++ b/test/libsolidity/semanticTests/array/evm_exceptions_out_of_band_access.sol @@ -12,7 +12,8 @@ contract A { return true; } } - +// ==== +// compileViaYul: also // ---- // test() -> false // testIt() -> FAILURE diff --git a/test/libsolidity/semanticTests/array/fixed_arrays_in_constructors.sol b/test/libsolidity/semanticTests/array/fixed_arrays_in_constructors.sol index ff13db5be..e85cb599e 100644 --- a/test/libsolidity/semanticTests/array/fixed_arrays_in_constructors.sol +++ b/test/libsolidity/semanticTests/array/fixed_arrays_in_constructors.sol @@ -7,7 +7,8 @@ contract Creator { ch = s[2]; } } - +// ==== +// compileViaYul: also // ---- // constructor(): 1, 2, 3, 4 -> // r() -> 4 diff --git a/test/libsolidity/semanticTests/array/fixed_bytes_length_access.sol b/test/libsolidity/semanticTests/array/fixed_bytes_length_access.sol index 7a6afbae7..ffeab647f 100644 --- a/test/libsolidity/semanticTests/array/fixed_bytes_length_access.sol +++ b/test/libsolidity/semanticTests/array/fixed_bytes_length_access.sol @@ -5,6 +5,7 @@ contract C { return (x.length, bytes16(uint128(2)).length, a.length + 7); } } - +// ==== +// compileViaYul: also // ---- // f(bytes32): "789" -> 32, 16, 8 diff --git a/test/libsolidity/semanticTests/array/memory_arrays_index_access_write.sol b/test/libsolidity/semanticTests/array/memory_arrays_index_access_write.sol index 7a8a18670..7de7f49be 100644 --- a/test/libsolidity/semanticTests/array/memory_arrays_index_access_write.sol +++ b/test/libsolidity/semanticTests/array/memory_arrays_index_access_write.sol @@ -10,5 +10,7 @@ contract Test { return data; } } +// ==== +// compileViaYul: also // ---- // f() -> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07 diff --git a/test/libsolidity/semanticTests/array/memory_arrays_of_various_sizes.sol b/test/libsolidity/semanticTests/array/memory_arrays_of_various_sizes.sol index b641ec1da..fd1fba0a1 100644 --- a/test/libsolidity/semanticTests/array/memory_arrays_of_various_sizes.sol +++ b/test/libsolidity/semanticTests/array/memory_arrays_of_various_sizes.sol @@ -11,7 +11,8 @@ contract C { return rows[n][k - 1]; } } - +// ==== +// compileViaYul: also // ---- // f(uint256,uint256): 3, 1 -> 1 // f(uint256,uint256): 9, 5 -> 70 diff --git a/test/libsolidity/semanticTests/array/push_no_args_1d.sol b/test/libsolidity/semanticTests/array/push_no_args_1d.sol index cf6f0687d..daf8d43b1 100644 --- a/test/libsolidity/semanticTests/array/push_no_args_1d.sol +++ b/test/libsolidity/semanticTests/array/push_no_args_1d.sol @@ -19,6 +19,8 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // l() -> 0 // lv(uint256): 42 -> diff --git a/test/libsolidity/semanticTests/cleanup/bool_conversion_v2.sol b/test/libsolidity/semanticTests/cleanup/bool_conversion_v2.sol index a8fd89833..69b590828 100644 --- a/test/libsolidity/semanticTests/cleanup/bool_conversion_v2.sol +++ b/test/libsolidity/semanticTests/cleanup/bool_conversion_v2.sol @@ -11,6 +11,8 @@ contract C { _out = _in; } } +// ==== +// compileViaYul: also // ---- // f(bool): 0x0 -> 0x0 // f(bool): 0x1 -> 0x1 diff --git a/test/libsolidity/semanticTests/cleanup/cleanup_address_types_v2.sol b/test/libsolidity/semanticTests/cleanup/cleanup_address_types_v2.sol index beff156f7..ce6ff4fe2 100644 --- a/test/libsolidity/semanticTests/cleanup/cleanup_address_types_v2.sol +++ b/test/libsolidity/semanticTests/cleanup/cleanup_address_types_v2.sol @@ -13,6 +13,8 @@ contract C { return 0; } } +// ==== +// compileViaYul: also // ---- // f(address): 0xffff1234567890123456789012345678901234567890 -> FAILURE # We input longer data on purpose.# // g(address): 0xffff1234567890123456789012345678901234567890 -> FAILURE diff --git a/test/libsolidity/semanticTests/cleanup/cleanup_bytes_types_v2.sol b/test/libsolidity/semanticTests/cleanup/cleanup_bytes_types_v2.sol index 5adc97378..2ca882c9f 100644 --- a/test/libsolidity/semanticTests/cleanup/cleanup_bytes_types_v2.sol +++ b/test/libsolidity/semanticTests/cleanup/cleanup_bytes_types_v2.sol @@ -10,5 +10,7 @@ contract C { return 0; } } +// ==== +// compileViaYul: also // ---- // f(bytes2,uint16): "abc", 0x40102 -> FAILURE # We input longer data on purpose. # diff --git a/test/libsolidity/semanticTests/cleanup/cleanup_in_compound_assign.sol b/test/libsolidity/semanticTests/cleanup/cleanup_in_compound_assign.sol index c1901c738..7cd496818 100644 --- a/test/libsolidity/semanticTests/cleanup/cleanup_in_compound_assign.sol +++ b/test/libsolidity/semanticTests/cleanup/cleanup_in_compound_assign.sol @@ -8,6 +8,7 @@ contract C { return (x, y); } } - +// ==== +// compileViaYul: also // ---- // test() -> 0xff, 0xff diff --git a/test/libsolidity/semanticTests/constructor/base_constructor_arguments.sol b/test/libsolidity/semanticTests/constructor/base_constructor_arguments.sol index 2384c061f..ffb98ada1 100644 --- a/test/libsolidity/semanticTests/constructor/base_constructor_arguments.sol +++ b/test/libsolidity/semanticTests/constructor/base_constructor_arguments.sol @@ -20,5 +20,7 @@ contract Derived is Base { } } +// ==== +// compileViaYul: also // ---- // getA() -> 49 diff --git a/test/libsolidity/semanticTests/constructor/constructor_arguments_external.sol b/test/libsolidity/semanticTests/constructor/constructor_arguments_external.sol index ec30bacf6..fe6a4c59b 100644 --- a/test/libsolidity/semanticTests/constructor/constructor_arguments_external.sol +++ b/test/libsolidity/semanticTests/constructor/constructor_arguments_external.sol @@ -15,7 +15,8 @@ contract Main { return flag; } } - +// ==== +// compileViaYul: also // ---- // constructor(): "abc", true // getFlag() -> true diff --git a/test/libsolidity/semanticTests/constructor/function_usage_in_constructor_arguments.sol b/test/libsolidity/semanticTests/constructor/function_usage_in_constructor_arguments.sol index e92a37b19..6f2f41428 100644 --- a/test/libsolidity/semanticTests/constructor/function_usage_in_constructor_arguments.sol +++ b/test/libsolidity/semanticTests/constructor/function_usage_in_constructor_arguments.sol @@ -20,5 +20,7 @@ contract Derived is Base { } } +// ==== +// compileViaYul: also // ---- // getA() -> 2 diff --git a/test/libsolidity/semanticTests/constructor/inline_member_init_inheritence_without_constructor.sol b/test/libsolidity/semanticTests/constructor/inline_member_init_inheritence_without_constructor.sol index 0aea44e6a..1e8f9bc78 100644 --- a/test/libsolidity/semanticTests/constructor/inline_member_init_inheritence_without_constructor.sol +++ b/test/libsolidity/semanticTests/constructor/inline_member_init_inheritence_without_constructor.sol @@ -14,7 +14,8 @@ contract Derived is Base { return m_derived; } } - +// ==== +// compileViaYul: also // ---- // getBMember() -> 5 // getDMember() -> 6 diff --git a/test/libsolidity/semanticTests/expressions/conditional_expression_different_types.sol b/test/libsolidity/semanticTests/expressions/conditional_expression_different_types.sol index df07364b3..4f3828f3a 100644 --- a/test/libsolidity/semanticTests/expressions/conditional_expression_different_types.sol +++ b/test/libsolidity/semanticTests/expressions/conditional_expression_different_types.sol @@ -5,6 +5,8 @@ contract test { return cond ? x : y; } } +// ==== +// compileViaYul: also // ---- // f(bool): true -> 0xcd // f(bool): false -> 0xabab diff --git a/test/libsolidity/semanticTests/expressions/conditional_expression_false_literal.sol b/test/libsolidity/semanticTests/expressions/conditional_expression_false_literal.sol index 3915c7b8d..456b1902c 100644 --- a/test/libsolidity/semanticTests/expressions/conditional_expression_false_literal.sol +++ b/test/libsolidity/semanticTests/expressions/conditional_expression_false_literal.sol @@ -3,5 +3,7 @@ contract test { return false ? 5 : 10; } } +// ==== +// compileViaYul: also // ---- // f() -> 10 diff --git a/test/libsolidity/semanticTests/expressions/conditional_expression_functions.sol b/test/libsolidity/semanticTests/expressions/conditional_expression_functions.sol index bff9122b1..482849648 100644 --- a/test/libsolidity/semanticTests/expressions/conditional_expression_functions.sol +++ b/test/libsolidity/semanticTests/expressions/conditional_expression_functions.sol @@ -7,6 +7,8 @@ contract test { return z(); } } +// ==== +// compileViaYul: also // ---- // f(bool): true -> 1 // f(bool): false -> 2 diff --git a/test/libsolidity/semanticTests/expressions/conditional_expression_multiple.sol b/test/libsolidity/semanticTests/expressions/conditional_expression_multiple.sol index 2a9d6de80..c8a335384 100644 --- a/test/libsolidity/semanticTests/expressions/conditional_expression_multiple.sol +++ b/test/libsolidity/semanticTests/expressions/conditional_expression_multiple.sol @@ -6,6 +6,8 @@ contract test { x > 50 ? 50 : 10; } } +// ==== +// compileViaYul: also // ---- // f(uint256): 1001 -> 1000 // f(uint256): 500 -> 100 diff --git a/test/libsolidity/semanticTests/expressions/conditional_expression_true_literal.sol b/test/libsolidity/semanticTests/expressions/conditional_expression_true_literal.sol index 06247f0dc..651455079 100644 --- a/test/libsolidity/semanticTests/expressions/conditional_expression_true_literal.sol +++ b/test/libsolidity/semanticTests/expressions/conditional_expression_true_literal.sol @@ -3,5 +3,7 @@ contract test { return true ? 5 : 10; } } +// ==== +// compileViaYul: also // ---- // f() -> 5 diff --git a/test/libsolidity/semanticTests/expressions/conditional_expression_tuples.sol b/test/libsolidity/semanticTests/expressions/conditional_expression_tuples.sol index d27d06bac..53eba3f1d 100644 --- a/test/libsolidity/semanticTests/expressions/conditional_expression_tuples.sol +++ b/test/libsolidity/semanticTests/expressions/conditional_expression_tuples.sol @@ -3,6 +3,8 @@ contract test { return cond ? (1, 2) : (3, 4); } } +// ==== +// compileViaYul: also // ---- // f(bool): true -> 1, 2 // f(bool): false -> 3, 4 diff --git a/test/libsolidity/semanticTests/expressions/conditional_expression_with_return_values.sol b/test/libsolidity/semanticTests/expressions/conditional_expression_with_return_values.sol index bbaf051bd..df6cdb344 100644 --- a/test/libsolidity/semanticTests/expressions/conditional_expression_with_return_values.sol +++ b/test/libsolidity/semanticTests/expressions/conditional_expression_with_return_values.sol @@ -3,6 +3,8 @@ contract test { cond ? a = v : b = v; } } +// ==== +// compileViaYul: also // ---- // f(bool,uint256): true, 20 -> 20, 0 // f(bool,uint256): false, 20 -> 0, 20 diff --git a/test/libsolidity/semanticTests/fallback/fallback_or_receive.sol b/test/libsolidity/semanticTests/fallback/fallback_or_receive.sol index 9b5319ae0..90efa8fda 100644 --- a/test/libsolidity/semanticTests/fallback/fallback_or_receive.sol +++ b/test/libsolidity/semanticTests/fallback/fallback_or_receive.sol @@ -5,6 +5,8 @@ contract C { receive () payable external { ++y; } function f() external returns (uint, uint) { return (x, y); } } +// ==== +// compileViaYul: also // ---- // f() -> 0, 0 // () -> diff --git a/test/libsolidity/semanticTests/fallback/inherited.sol b/test/libsolidity/semanticTests/fallback/inherited.sol index a4ee55419..1e0cdc407 100644 --- a/test/libsolidity/semanticTests/fallback/inherited.sol +++ b/test/libsolidity/semanticTests/fallback/inherited.sol @@ -4,6 +4,8 @@ contract A { function getData() public returns (uint r) { return data; } } contract B is A {} +// ==== +// compileViaYul: also // ---- // getData() -> 0 // (): 42 -> diff --git a/test/libsolidity/semanticTests/fallback/short_data_calls_fallback.sol b/test/libsolidity/semanticTests/fallback/short_data_calls_fallback.sol index dd97f4c03..57dbb37bb 100644 --- a/test/libsolidity/semanticTests/fallback/short_data_calls_fallback.sol +++ b/test/libsolidity/semanticTests/fallback/short_data_calls_fallback.sol @@ -4,6 +4,8 @@ contract A { function fow() public { x = 3; } fallback () external { x = 2; } } +// ==== +// compileViaYul: also // ---- // (): hex"d88e0b" // x() -> 2 diff --git a/test/libsolidity/semanticTests/functionCall/array_multiple_local_vars.sol b/test/libsolidity/semanticTests/functionCall/array_multiple_local_vars.sol index 4dbfe91f1..52ddfff98 100644 --- a/test/libsolidity/semanticTests/functionCall/array_multiple_local_vars.sol +++ b/test/libsolidity/semanticTests/functionCall/array_multiple_local_vars.sol @@ -22,6 +22,8 @@ contract test { return sum; } } +// ==== +// compileViaYul: also // ---- // f(uint256[]): 32, 3, 1000, 1, 2 -> 3 // f(uint256[]): 32, 3, 100, 500, 300 -> 600 diff --git a/test/libsolidity/semanticTests/functionCall/call_unimplemented_base.sol b/test/libsolidity/semanticTests/functionCall/call_unimplemented_base.sol index 3041f0e4b..862f37f8d 100644 --- a/test/libsolidity/semanticTests/functionCall/call_unimplemented_base.sol +++ b/test/libsolidity/semanticTests/functionCall/call_unimplemented_base.sol @@ -10,5 +10,7 @@ contract C is V { function a() internal view override returns (uint256) { return 42;} } +// ==== +// compileViaYul: also // ---- // b() -> 42 diff --git a/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function.sol b/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function.sol index e1cab8fe8..c074d8598 100644 --- a/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function.sol +++ b/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function.sol @@ -11,7 +11,8 @@ contract C { return 7; } } - +// ==== +// compileViaYul: also // ---- // intern() -> FAILURE # This should throw exceptions # // extern() -> FAILURE diff --git a/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function_through_array.sol b/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function_through_array.sol index 26a2a79f4..44af5be40 100644 --- a/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function_through_array.sol +++ b/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function_through_array.sol @@ -15,6 +15,7 @@ contract C { return 2; } } - +// ==== +// compileViaYul: also // ---- // t() -> FAILURE diff --git a/test/libsolidity/semanticTests/functionCall/mapping_array_internal_argument.sol b/test/libsolidity/semanticTests/functionCall/mapping_array_internal_argument.sol index 54baa4572..4fcc640f6 100644 --- a/test/libsolidity/semanticTests/functionCall/mapping_array_internal_argument.sol +++ b/test/libsolidity/semanticTests/functionCall/mapping_array_internal_argument.sol @@ -16,6 +16,8 @@ contract test { return (a[0][key], a[1][key], b[0][key], b[1][key]); } } +// ==== +// compileViaYul: also // ---- // set(uint8,uint8,uint8,uint8,uint8): 1, 21, 22, 42, 43 -> 0, 0, 0, 0 // get(uint8): 1 -> 21, 22, 42, 43 diff --git a/test/libsolidity/semanticTests/functionCall/mapping_internal_argument.sol b/test/libsolidity/semanticTests/functionCall/mapping_internal_argument.sol index 728be2c09..4154baa9b 100644 --- a/test/libsolidity/semanticTests/functionCall/mapping_internal_argument.sol +++ b/test/libsolidity/semanticTests/functionCall/mapping_internal_argument.sol @@ -14,6 +14,8 @@ contract test { return (a[key], b[key]); } } +// ==== +// compileViaYul: also // ---- // set(uint8,uint8,uint8): 1, 21, 42 -> 0, 0 // get(uint8): 1 -> 21, 42 diff --git a/test/libsolidity/semanticTests/functionCall/multiple_functions.sol b/test/libsolidity/semanticTests/functionCall/multiple_functions.sol index 3c60a13f1..e72922d7b 100644 --- a/test/libsolidity/semanticTests/functionCall/multiple_functions.sol +++ b/test/libsolidity/semanticTests/functionCall/multiple_functions.sol @@ -6,6 +6,7 @@ contract test { } // ==== // allowNonExistingFunctions: true +// compileViaYul: also // ---- // a() -> 0 // b() -> 1 diff --git a/test/libsolidity/semanticTests/functionCall/named_args.sol b/test/libsolidity/semanticTests/functionCall/named_args.sol index 132139b99..e959eba44 100644 --- a/test/libsolidity/semanticTests/functionCall/named_args.sol +++ b/test/libsolidity/semanticTests/functionCall/named_args.sol @@ -2,5 +2,7 @@ contract test { function a(uint a, uint b, uint c) public returns (uint r) { r = a * 100 + b * 10 + c * 1; } function b() public returns (uint r) { r = a({a: 1, b: 2, c: 3}); } } +// ==== +// compileViaYul: also // ---- // b() -> 123 diff --git a/test/libsolidity/semanticTests/functionCall/send_zero_ether.sol b/test/libsolidity/semanticTests/functionCall/send_zero_ether.sol index e0c6ff5e0..07f6ff51d 100644 --- a/test/libsolidity/semanticTests/functionCall/send_zero_ether.sol +++ b/test/libsolidity/semanticTests/functionCall/send_zero_ether.sol @@ -14,6 +14,8 @@ contract Main { } } +// ==== +// compileViaYul: also // ---- // constructor(), 20 wei -> // s() -> true diff --git a/test/libsolidity/semanticTests/functionCall/transaction_status.sol b/test/libsolidity/semanticTests/functionCall/transaction_status.sol index 6651630d5..449ebacbe 100644 --- a/test/libsolidity/semanticTests/functionCall/transaction_status.sol +++ b/test/libsolidity/semanticTests/functionCall/transaction_status.sol @@ -3,6 +3,8 @@ contract test { function g() public { revert(); } function h() public { assert(false); } } +// ==== +// compileViaYul: also // ---- // f() -> // g() -> FAILURE diff --git a/test/libsolidity/semanticTests/functionCall/value_test.sol b/test/libsolidity/semanticTests/functionCall/value_test.sol index 582cda9f6..9cd1fd9ef 100644 --- a/test/libsolidity/semanticTests/functionCall/value_test.sol +++ b/test/libsolidity/semanticTests/functionCall/value_test.sol @@ -3,6 +3,8 @@ contract C { return msg.value; } } +// ==== +// compileViaYul: also // ---- // f(), 1 ether -> 1000000000000000000 // f(), 1 wei -> 1 \ No newline at end of file diff --git a/test/libsolidity/semanticTests/functionTypes/pass_function_types_internally.sol b/test/libsolidity/semanticTests/functionTypes/pass_function_types_internally.sol index 6fb4f5f6e..0acbcc585 100644 --- a/test/libsolidity/semanticTests/functionTypes/pass_function_types_internally.sol +++ b/test/libsolidity/semanticTests/functionTypes/pass_function_types_internally.sol @@ -7,10 +7,9 @@ contract C { return x(a); } - function g(uint256 x) public returns (uint256) { + function g(uint256 x) public pure returns (uint256) { return x + 1; } } - // ---- // f(uint256): 7 -> 8 diff --git a/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime.sol b/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime.sol index a79cb2d76..d829c1554 100644 --- a/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime.sol +++ b/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime.sol @@ -13,7 +13,8 @@ contract C { return double(_arg); } } - +// ==== +// compileViaYul: also // ---- // runtime(uint256): 3 -> 6 // initial() -> 4 diff --git a/test/libsolidity/semanticTests/immutable/multi_creation.sol b/test/libsolidity/semanticTests/immutable/multi_creation.sol index b9e362dbd..970ea9155 100644 --- a/test/libsolidity/semanticTests/immutable/multi_creation.sol +++ b/test/libsolidity/semanticTests/immutable/multi_creation.sol @@ -25,6 +25,8 @@ contract C { return (a, (new A()).f(), (new B()).f()); } } +// ==== +// compileViaYul: also // ---- // f() -> 3, 7, 5 // x() -> 7 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access.sol index 823afe2bd..8e42595d4 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access.sol @@ -16,7 +16,8 @@ contract C { return true; } } - +// ==== +// compileViaYul: also // ---- // f() -> true // z() -> 7 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_inside_function.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_inside_function.sol index ce56dbaa1..8f48f2f52 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_inside_function.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_inside_function.sol @@ -17,7 +17,8 @@ contract C { return true; } } - +// ==== +// compileViaYul: also // ---- // f() -> true // z() -> 7 diff --git a/test/libsolidity/semanticTests/inlineAssembly/leave.sol b/test/libsolidity/semanticTests/inlineAssembly/leave.sol index 40add273e..b8c0ccda2 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/leave.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/leave.sol @@ -10,5 +10,7 @@ contract C { } } } +// ==== +// compileViaYul: also // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/interfaceID/homer_interfaceId.sol b/test/libsolidity/semanticTests/interfaceID/homer_interfaceId.sol index d2fa2e821..855ca4d40 100644 --- a/test/libsolidity/semanticTests/interfaceID/homer_interfaceId.sol +++ b/test/libsolidity/semanticTests/interfaceID/homer_interfaceId.sol @@ -29,6 +29,8 @@ contract Homer is ERC165, Simpson { } } +// ==== +// compileViaYul: also // ---- // supportsInterface(bytes4): left(0x01ffc9a0) -> false // supportsInterface(bytes4): left(0x01ffc9a7) -> true diff --git a/test/libsolidity/semanticTests/interfaceID/lisa_interfaceId.sol b/test/libsolidity/semanticTests/interfaceID/lisa_interfaceId.sol index 9c9dd5eb7..96f1a4742 100644 --- a/test/libsolidity/semanticTests/interfaceID/lisa_interfaceId.sol +++ b/test/libsolidity/semanticTests/interfaceID/lisa_interfaceId.sol @@ -40,6 +40,8 @@ contract Lisa is ERC165MappingImplementation, Simpson { } } +// ==== +// compileViaYul: also // ---- // supportsInterface(bytes4): left(0x01ffc9a0) -> false // supportsInterface(bytes4): left(0x01ffc9a7) -> true diff --git a/test/libsolidity/semanticTests/intheritance/inherited_function_calldata_memory.sol b/test/libsolidity/semanticTests/intheritance/inherited_function_calldata_memory.sol index 0fd02e8f3..a9956cc80 100644 --- a/test/libsolidity/semanticTests/intheritance/inherited_function_calldata_memory.sol +++ b/test/libsolidity/semanticTests/intheritance/inherited_function_calldata_memory.sol @@ -17,6 +17,7 @@ contract B is A { return A(this).f(m); } } - +// ==== +// compileViaYul: also // ---- // g() -> 23 diff --git a/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base.sol b/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base.sol index 26de9ce70..98922c389 100644 --- a/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base.sol +++ b/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base.sol @@ -14,5 +14,7 @@ contract Derived is Base { contract Final is Derived(4) {} +// ==== +// compileViaYul: also // ---- // m_i() -> 4 diff --git a/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base_base.sol b/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base_base.sol index 6349bd814..cab918567 100644 --- a/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base_base.sol +++ b/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base_base.sol @@ -19,5 +19,7 @@ contract Derived is Base, Base1 { contract Final is Derived(4) {} +// ==== +// compileViaYul: also // ---- // m_i() -> 4 diff --git a/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base_base_with_gap.sol b/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base_base_with_gap.sol index 4556cf5c4..ab7bada38 100644 --- a/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base_base_with_gap.sol +++ b/test/libsolidity/semanticTests/intheritance/pass_dynamic_arguments_to_the_base_base_with_gap.sol @@ -19,5 +19,7 @@ contract Derived is Base, Base1 { contract Final is Derived(4) {} +// ==== +// compileViaYul: also // ---- // m_i() -> 4 diff --git a/test/libsolidity/semanticTests/libraries/library_enum_as_an_expression.sol b/test/libsolidity/semanticTests/libraries/library_enum_as_an_expression.sol index f24d93c2d..31a64ce20 100644 --- a/test/libsolidity/semanticTests/libraries/library_enum_as_an_expression.sol +++ b/test/libsolidity/semanticTests/libraries/library_enum_as_an_expression.sol @@ -10,5 +10,7 @@ contract Tsra { } } +// ==== +// compileViaYul: also // ---- // f() -> 1 diff --git a/test/libsolidity/semanticTests/libraries/library_struct_as_an_expression.sol b/test/libsolidity/semanticTests/libraries/library_struct_as_an_expression.sol index d7df52434..9965a3815 100644 --- a/test/libsolidity/semanticTests/libraries/library_struct_as_an_expression.sol +++ b/test/libsolidity/semanticTests/libraries/library_struct_as_an_expression.sol @@ -13,5 +13,7 @@ contract Tsra { } } +// ==== +// compileViaYul: also // ---- // f() -> 1 diff --git a/test/libsolidity/semanticTests/literals/hex_string_with_underscore.sol b/test/libsolidity/semanticTests/literals/hex_string_with_underscore.sol index db7f70f83..3194d7ee9 100644 --- a/test/libsolidity/semanticTests/literals/hex_string_with_underscore.sol +++ b/test/libsolidity/semanticTests/literals/hex_string_with_underscore.sol @@ -3,5 +3,7 @@ contract C { return hex"12_34_5678_9A"; } } +// ==== +// compileViaYul: also // ---- // f() -> 32, 5, left(0x123456789A) diff --git a/test/libsolidity/semanticTests/modifiers/break_in_modifier.sol b/test/libsolidity/semanticTests/modifiers/break_in_modifier.sol index 1d1036c2c..27a9550cf 100644 --- a/test/libsolidity/semanticTests/modifiers/break_in_modifier.sol +++ b/test/libsolidity/semanticTests/modifiers/break_in_modifier.sol @@ -13,7 +13,8 @@ contract C { x = t; } } - +// ==== +// compileViaYul: also // ---- // x() -> 0 // f() -> diff --git a/test/libsolidity/semanticTests/modifiers/stacked_return_with_modifiers.sol b/test/libsolidity/semanticTests/modifiers/stacked_return_with_modifiers.sol index 1d1036c2c..27a9550cf 100644 --- a/test/libsolidity/semanticTests/modifiers/stacked_return_with_modifiers.sol +++ b/test/libsolidity/semanticTests/modifiers/stacked_return_with_modifiers.sol @@ -13,7 +13,8 @@ contract C { x = t; } } - +// ==== +// compileViaYul: also // ---- // x() -> 0 // f() -> diff --git a/test/libsolidity/semanticTests/receive/empty_calldata_calls_receive.sol b/test/libsolidity/semanticTests/receive/empty_calldata_calls_receive.sol index ce04cd737..b6e9416a7 100644 --- a/test/libsolidity/semanticTests/receive/empty_calldata_calls_receive.sol +++ b/test/libsolidity/semanticTests/receive/empty_calldata_calls_receive.sol @@ -2,6 +2,8 @@ contract A { uint public x; receive () external payable { ++x; } } +// ==== +// compileViaYul: also // ---- // x() -> 0 // () diff --git a/test/libsolidity/semanticTests/receive/ether_and_data.sol b/test/libsolidity/semanticTests/receive/ether_and_data.sol index 4c48df8d4..44af7ab91 100644 --- a/test/libsolidity/semanticTests/receive/ether_and_data.sol +++ b/test/libsolidity/semanticTests/receive/ether_and_data.sol @@ -1,6 +1,8 @@ contract C { receive () payable external { } } +// ==== +// compileViaYul: also // ---- // (), 1 ether // (), 1 ether: 1 -> FAILURE diff --git a/test/libsolidity/semanticTests/receive/inherited.sol b/test/libsolidity/semanticTests/receive/inherited.sol index 36273068a..a71322983 100644 --- a/test/libsolidity/semanticTests/receive/inherited.sol +++ b/test/libsolidity/semanticTests/receive/inherited.sol @@ -4,6 +4,8 @@ contract A { function getData() public returns (uint r) { return data; } } contract B is A {} +// ==== +// compileViaYul: also // ---- // getData() -> 0 // () -> diff --git a/test/libsolidity/semanticTests/revertStrings/array_slices.sol b/test/libsolidity/semanticTests/revertStrings/array_slices.sol index dec3e916d..5d2cebb87 100644 --- a/test/libsolidity/semanticTests/revertStrings/array_slices.sol +++ b/test/libsolidity/semanticTests/revertStrings/array_slices.sol @@ -6,6 +6,7 @@ contract C { // ==== // EVMVersion: >=byzantium // revertStrings: debug +// compileViaYul: also // ---- // f(uint256,uint256,uint256[]): 2, 1, 0x80, 3, 1, 2, 3 -> FAILURE, hex"08c379a0", 0x20, 22, "Slice starts after end" // f(uint256,uint256,uint256[]): 1, 5, 0x80, 3, 1, 2, 3 -> FAILURE, hex"08c379a0", 0x20, 28, "Slice is greater than length" diff --git a/test/libsolidity/semanticTests/revertStrings/calldata_array_dynamic_invalid.sol b/test/libsolidity/semanticTests/revertStrings/calldata_array_dynamic_invalid.sol index 2538a2175..e91f08a03 100644 --- a/test/libsolidity/semanticTests/revertStrings/calldata_array_dynamic_invalid.sol +++ b/test/libsolidity/semanticTests/revertStrings/calldata_array_dynamic_invalid.sol @@ -7,5 +7,6 @@ contract C { // ==== // EVMVersion: >=byzantium // revertStrings: debug +// compileViaYul: also // ---- // f(uint256[][]): 0x20, 1 -> FAILURE, hex"08c379a0", 0x20, 43, "ABI decoding: invalid calldata a", "rray stride" diff --git a/test/libsolidity/semanticTests/revertStrings/calldata_array_dynamic_static_short_decode.sol b/test/libsolidity/semanticTests/revertStrings/calldata_array_dynamic_static_short_decode.sol index 9f9296d2a..d39b3f4fb 100644 --- a/test/libsolidity/semanticTests/revertStrings/calldata_array_dynamic_static_short_decode.sol +++ b/test/libsolidity/semanticTests/revertStrings/calldata_array_dynamic_static_short_decode.sol @@ -8,5 +8,6 @@ contract C { // ==== // EVMVersion: >=byzantium // revertStrings: debug +// compileViaYul: also // ---- // f(uint256[][2][]): 0x20, 0x01, 0x20, 0x00 -> FAILURE, hex"08c379a0", 0x20, 28, "Invalid calldata tail offset" diff --git a/test/libsolidity/semanticTests/revertStrings/calldata_array_dynamic_static_short_reencode.sol b/test/libsolidity/semanticTests/revertStrings/calldata_array_dynamic_static_short_reencode.sol index 7aac0f7f8..0e2ba94b1 100644 --- a/test/libsolidity/semanticTests/revertStrings/calldata_array_dynamic_static_short_reencode.sol +++ b/test/libsolidity/semanticTests/revertStrings/calldata_array_dynamic_static_short_reencode.sol @@ -10,5 +10,6 @@ contract C { // ==== // EVMVersion: >=byzantium // revertStrings: debug +// compileViaYul: also // ---- // g(uint256[][2][]): 0x20, 0x01, 0x20, 0x00 -> FAILURE, hex"08c379a0", 0x20, 30, "Invalid calldata access offset" diff --git a/test/libsolidity/semanticTests/revertStrings/calldata_array_invalid_length.sol b/test/libsolidity/semanticTests/revertStrings/calldata_array_invalid_length.sol index 3b68bacea..f54a47d73 100644 --- a/test/libsolidity/semanticTests/revertStrings/calldata_array_invalid_length.sol +++ b/test/libsolidity/semanticTests/revertStrings/calldata_array_invalid_length.sol @@ -7,5 +7,6 @@ contract C { // ==== // EVMVersion: >=byzantium // revertStrings: debug +// compileViaYul: also // ---- // f(uint256[][]): 0x20, 1, 0x20, 0x0100000000000000000000 -> FAILURE, hex"08c379a0", 0x20, 28, "Invalid calldata tail length" diff --git a/test/libsolidity/semanticTests/revertStrings/calldata_arrays_too_large.sol b/test/libsolidity/semanticTests/revertStrings/calldata_arrays_too_large.sol index 52809a0b2..c19538d0a 100644 --- a/test/libsolidity/semanticTests/revertStrings/calldata_arrays_too_large.sol +++ b/test/libsolidity/semanticTests/revertStrings/calldata_arrays_too_large.sol @@ -7,5 +7,6 @@ contract C { // ==== // EVMVersion: >=byzantium // revertStrings: debug +// compileViaYul: also // ---- // f(uint256,uint256[],uint256): 6, 0x60, 9, 0x1000000000000000000000000000000000000000000000000000000000000002, 1, 2 -> FAILURE, hex"08c379a0", 0x20, 43, "ABI decoding: invalid calldata a", "rray length" diff --git a/test/libsolidity/semanticTests/revertStrings/calldata_tail_short.sol b/test/libsolidity/semanticTests/revertStrings/calldata_tail_short.sol index b6cc5800d..c3fcece1b 100644 --- a/test/libsolidity/semanticTests/revertStrings/calldata_tail_short.sol +++ b/test/libsolidity/semanticTests/revertStrings/calldata_tail_short.sol @@ -5,5 +5,6 @@ contract C { // ==== // EVMVersion: >=byzantium // revertStrings: debug +// compileViaYul: also // ---- // f(uint256[][]): 0x20, 1, 0x20, 2, 0x42 -> FAILURE, hex"08c379a0", 0x20, 23, "Calldata tail too short" diff --git a/test/libsolidity/semanticTests/revertStrings/short_input_array.sol b/test/libsolidity/semanticTests/revertStrings/short_input_array.sol index 1a80acc26..4c83b79ff 100644 --- a/test/libsolidity/semanticTests/revertStrings/short_input_array.sol +++ b/test/libsolidity/semanticTests/revertStrings/short_input_array.sol @@ -5,5 +5,6 @@ contract C { // ==== // EVMVersion: >=byzantium // revertStrings: debug +// compileViaYul: also // ---- // f(uint256[]): 0x20, 1 -> FAILURE, hex"08c379a0", 0x20, 43, "ABI decoding: invalid calldata a", "rray stride" diff --git a/test/libsolidity/semanticTests/revertStrings/short_input_bytes.sol b/test/libsolidity/semanticTests/revertStrings/short_input_bytes.sol index f361da7b6..b8bb0493a 100644 --- a/test/libsolidity/semanticTests/revertStrings/short_input_bytes.sol +++ b/test/libsolidity/semanticTests/revertStrings/short_input_bytes.sol @@ -5,5 +5,6 @@ contract C { // ==== // EVMVersion: >=byzantium // revertStrings: debug +// compileViaYul: also // ---- // e(bytes): 0x20, 7 -> FAILURE, hex"08c379a0", 0x20, 39, "ABI decoding: invalid byte array", " length" diff --git a/test/libsolidity/semanticTests/reverts/invalid_enum_as_external_arg.sol b/test/libsolidity/semanticTests/reverts/invalid_enum_as_external_arg.sol index d0adf2785..1d240813a 100644 --- a/test/libsolidity/semanticTests/reverts/invalid_enum_as_external_arg.sol +++ b/test/libsolidity/semanticTests/reverts/invalid_enum_as_external_arg.sol @@ -15,6 +15,7 @@ contract C { return this.tested(garbled); } } - +// ==== +// compileViaYul: also // ---- // test() -> FAILURE # should throw # diff --git a/test/libsolidity/semanticTests/reverts/revert.sol b/test/libsolidity/semanticTests/reverts/revert.sol index eae49c799..02496ef94 100644 --- a/test/libsolidity/semanticTests/reverts/revert.sol +++ b/test/libsolidity/semanticTests/reverts/revert.sol @@ -14,6 +14,8 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f() -> FAILURE // a() -> 42 diff --git a/test/libsolidity/semanticTests/reverts/simple_throw.sol b/test/libsolidity/semanticTests/reverts/simple_throw.sol index ad88deca6..bf9df114c 100644 --- a/test/libsolidity/semanticTests/reverts/simple_throw.sol +++ b/test/libsolidity/semanticTests/reverts/simple_throw.sol @@ -6,6 +6,8 @@ contract Test { } } +// ==== +// compileViaYul: also // ---- // f(uint256): 11 -> 21 // f(uint256): 1 -> FAILURE diff --git a/test/libsolidity/semanticTests/salted_create/salted_create_with_value.sol b/test/libsolidity/semanticTests/salted_create/salted_create_with_value.sol index f8b02693d..4e62acc5e 100644 --- a/test/libsolidity/semanticTests/salted_create/salted_create_with_value.sol +++ b/test/libsolidity/semanticTests/salted_create/salted_create_with_value.sol @@ -18,6 +18,7 @@ contract A { } } // ==== +// compileViaYul: also // EVMVersion: >=constantinople // ---- // f(), 10 ether -> 3007, 3008, 3009 diff --git a/test/libsolidity/semanticTests/shifts/shift_constant_left.sol b/test/libsolidity/semanticTests/shifts/shift_constant_left.sol index 4c6f3737f..4e43cae37 100644 --- a/test/libsolidity/semanticTests/shifts/shift_constant_left.sol +++ b/test/libsolidity/semanticTests/shifts/shift_constant_left.sol @@ -1,6 +1,7 @@ contract C { uint256 public a = 0x42 << 8; } - +// ==== +// compileViaYul: also // ---- // a() -> 0x4200 diff --git a/test/libsolidity/semanticTests/shifts/shift_constant_right.sol b/test/libsolidity/semanticTests/shifts/shift_constant_right.sol index 766a8522e..8278e045c 100644 --- a/test/libsolidity/semanticTests/shifts/shift_constant_right.sol +++ b/test/libsolidity/semanticTests/shifts/shift_constant_right.sol @@ -1,6 +1,7 @@ contract C { uint256 public a = 0x4200 >> 8; } - +// ==== +// compileViaYul: also // ---- // a() -> 0x42 diff --git a/test/libsolidity/semanticTests/shifts/shift_negative_constant_left.sol b/test/libsolidity/semanticTests/shifts/shift_negative_constant_left.sol index b92fb2229..964b6543b 100644 --- a/test/libsolidity/semanticTests/shifts/shift_negative_constant_left.sol +++ b/test/libsolidity/semanticTests/shifts/shift_negative_constant_left.sol @@ -1,6 +1,7 @@ contract C { int256 public a = -0x42 << 8; } - +// ==== +// compileViaYul: also // ---- // a() -> -16896 diff --git a/test/libsolidity/semanticTests/shifts/shift_negative_constant_right.sol b/test/libsolidity/semanticTests/shifts/shift_negative_constant_right.sol index b08463333..993fae441 100644 --- a/test/libsolidity/semanticTests/shifts/shift_negative_constant_right.sol +++ b/test/libsolidity/semanticTests/shifts/shift_negative_constant_right.sol @@ -1,6 +1,7 @@ contract C { int256 public a = -0x4200 >> 8; } - +// ==== +// compileViaYul: also // ---- // a() -> -66 diff --git a/test/libsolidity/semanticTests/smoke/bytes_and_strings.sol b/test/libsolidity/semanticTests/smoke/bytes_and_strings.sol index db6f35497..6bfc1da0a 100644 --- a/test/libsolidity/semanticTests/smoke/bytes_and_strings.sol +++ b/test/libsolidity/semanticTests/smoke/bytes_and_strings.sol @@ -12,6 +12,8 @@ contract C { return "any"; } } +// ==== +// compileViaYul: also // ---- // e(bytes): 32, 3, hex"AB33BB" -> 32, 3, left(0xAB33BB) // e(bytes): 32, 32, 0x20 -> 32, 32, 0x20 diff --git a/test/libsolidity/semanticTests/smoke/constructor.sol b/test/libsolidity/semanticTests/smoke/constructor.sol index e3bee950f..27e26f1eb 100644 --- a/test/libsolidity/semanticTests/smoke/constructor.sol +++ b/test/libsolidity/semanticTests/smoke/constructor.sol @@ -10,6 +10,8 @@ contract C { state = _state; } } +// ==== +// compileViaYul: also // ---- // constructor(), 2 wei: 3 -> // state() -> 3 diff --git a/test/libsolidity/semanticTests/specialFunctions/abi_functions_member_access.sol b/test/libsolidity/semanticTests/specialFunctions/abi_functions_member_access.sol index b255b1880..5d18cf32d 100644 --- a/test/libsolidity/semanticTests/specialFunctions/abi_functions_member_access.sol +++ b/test/libsolidity/semanticTests/specialFunctions/abi_functions_member_access.sol @@ -7,5 +7,7 @@ contract C { abi.decode; } } +// ==== +// compileViaYul: also // ---- // f() -> diff --git a/test/libsolidity/semanticTests/storage/complex_accessors.sol b/test/libsolidity/semanticTests/storage/complex_accessors.sol index 1169e4ea5..9b3fa7a3c 100644 --- a/test/libsolidity/semanticTests/storage/complex_accessors.sol +++ b/test/libsolidity/semanticTests/storage/complex_accessors.sol @@ -10,6 +10,8 @@ contract test { to_multiple_map[42][23] = 31; } } +// ==== +// compileViaYul: also // ---- // to_string_map(uint256): 42 -> "24" // to_bool_map(uint256): 42 -> false diff --git a/test/libsolidity/semanticTests/storage/simple_accessor.sol b/test/libsolidity/semanticTests/storage/simple_accessor.sol index 23bcfbfac..aacfb93a0 100644 --- a/test/libsolidity/semanticTests/storage/simple_accessor.sol +++ b/test/libsolidity/semanticTests/storage/simple_accessor.sol @@ -4,5 +4,7 @@ contract test { data = 8; } } +// ==== +// compileViaYul: also // ---- // data() -> 8 diff --git a/test/libsolidity/semanticTests/tryCatch/assert.sol b/test/libsolidity/semanticTests/tryCatch/assert.sol index 8b6a7b996..be475a3f2 100644 --- a/test/libsolidity/semanticTests/tryCatch/assert.sol +++ b/test/libsolidity/semanticTests/tryCatch/assert.sol @@ -11,6 +11,8 @@ contract C { } } } +// ==== +// compileViaYul: also // ---- // f(bool): true -> 1 // f(bool): false -> 2 diff --git a/test/libsolidity/semanticTests/tryCatch/trivial.sol b/test/libsolidity/semanticTests/tryCatch/trivial.sol index d43477e99..567b4b714 100644 --- a/test/libsolidity/semanticTests/tryCatch/trivial.sol +++ b/test/libsolidity/semanticTests/tryCatch/trivial.sol @@ -11,6 +11,8 @@ contract C { } } } +// ==== +// compileViaYul: also // ---- // f(bool): true -> 1 // f(bool): false -> 2 diff --git a/test/libsolidity/semanticTests/types/assign_calldata_value_type.sol b/test/libsolidity/semanticTests/types/assign_calldata_value_type.sol index 8350628e4..c7d2d8bf8 100644 --- a/test/libsolidity/semanticTests/types/assign_calldata_value_type.sol +++ b/test/libsolidity/semanticTests/types/assign_calldata_value_type.sol @@ -5,5 +5,7 @@ contract C { return (x, b); } } +// ==== +// compileViaYul: also // ---- // f(uint256): 23 -> 42, 23 diff --git a/test/libsolidity/semanticTests/types/external_function_to_address.sol b/test/libsolidity/semanticTests/types/external_function_to_address.sol index fb938d37a..8ae544855 100644 --- a/test/libsolidity/semanticTests/types/external_function_to_address.sol +++ b/test/libsolidity/semanticTests/types/external_function_to_address.sol @@ -6,6 +6,8 @@ contract C { return cb.address; } } +// ==== +// compileViaYul: also // ---- // f() -> true // g(function): hex"00000000000000000000000000000000000004226121ff00000000000000000" -> 0x42 diff --git a/test/libsolidity/semanticTests/types/mapping_contract_key_getter.sol b/test/libsolidity/semanticTests/types/mapping_contract_key_getter.sol index ee916a63d..8e29ad63e 100644 --- a/test/libsolidity/semanticTests/types/mapping_contract_key_getter.sol +++ b/test/libsolidity/semanticTests/types/mapping_contract_key_getter.sol @@ -8,6 +8,8 @@ contract test { return this.table(k); } } +// ==== +// compileViaYul: also // ---- // table(address): 0 -> 0 // table(address): 0x01 -> 0 diff --git a/test/libsolidity/semanticTests/types/mapping_enum_key_getter_v2.sol b/test/libsolidity/semanticTests/types/mapping_enum_key_getter_v2.sol index f1fd184ed..f822a9395 100644 --- a/test/libsolidity/semanticTests/types/mapping_enum_key_getter_v2.sol +++ b/test/libsolidity/semanticTests/types/mapping_enum_key_getter_v2.sol @@ -9,6 +9,8 @@ contract test { return this.table(k); } } +// ==== +// compileViaYul: also // ---- // table(uint8): 0 -> 0 // table(uint8): 0x01 -> 0 diff --git a/test/libsolidity/semanticTests/types/packing_signed_types.sol b/test/libsolidity/semanticTests/types/packing_signed_types.sol index 2d2e0e16e..3a10fd336 100644 --- a/test/libsolidity/semanticTests/types/packing_signed_types.sol +++ b/test/libsolidity/semanticTests/types/packing_signed_types.sol @@ -4,5 +4,7 @@ contract test { return int8(x); } } +// ==== +// compileViaYul: also // ---- // run() -> 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa diff --git a/test/libsolidity/semanticTests/types/packing_unpacking_types.sol b/test/libsolidity/semanticTests/types/packing_unpacking_types.sol index 8b500cca1..ea2ed58f2 100644 --- a/test/libsolidity/semanticTests/types/packing_unpacking_types.sol +++ b/test/libsolidity/semanticTests/types/packing_unpacking_types.sol @@ -5,6 +5,8 @@ contract test { y = y * 0x10000000000000000 | ~c; } } +// ==== +// compileViaYul: also // ---- // run(bool,uint32,uint64): true, 0x0f0f0f0f, 0xf0f0f0f0f0f0f0f0 // -> 0x0000000000000000000000000000000000000001f0f0f0f00f0f0f0f0f0f0f0f diff --git a/test/libsolidity/semanticTests/variables/mapping_local_assignment.sol b/test/libsolidity/semanticTests/variables/mapping_local_assignment.sol index b99385823..b4b158f62 100644 --- a/test/libsolidity/semanticTests/variables/mapping_local_assignment.sol +++ b/test/libsolidity/semanticTests/variables/mapping_local_assignment.sol @@ -11,5 +11,7 @@ contract test { return (m1[1], m1[2], m2[1], m2[2]); } } +// ==== +// compileViaYul: also // ---- // f() -> 42, 0, 0, 21 diff --git a/test/libsolidity/semanticTests/variables/mapping_local_compound_assignment.sol b/test/libsolidity/semanticTests/variables/mapping_local_compound_assignment.sol index df3ee2f54..5e237ae17 100644 --- a/test/libsolidity/semanticTests/variables/mapping_local_compound_assignment.sol +++ b/test/libsolidity/semanticTests/variables/mapping_local_compound_assignment.sol @@ -10,5 +10,7 @@ contract test { return (m1[1], m1[2], m2[1], m2[2]); } } +// ==== +// compileViaYul: also // ---- // f() -> 42, 0, 0, 21 diff --git a/test/libsolidity/semanticTests/variables/public_state_overridding.sol b/test/libsolidity/semanticTests/variables/public_state_overridding.sol index 2921f1a4a..bff486eaa 100644 --- a/test/libsolidity/semanticTests/variables/public_state_overridding.sol +++ b/test/libsolidity/semanticTests/variables/public_state_overridding.sol @@ -11,8 +11,8 @@ contract X is A function set() public { test = 2; } } - - +// ==== +// compileViaYul: also // ---- // test() -> 0 // set() -> diff --git a/test/libsolidity/semanticTests/various/decayed_tuple.sol b/test/libsolidity/semanticTests/various/decayed_tuple.sol index b00942cb3..2f1122f6a 100644 --- a/test/libsolidity/semanticTests/various/decayed_tuple.sol +++ b/test/libsolidity/semanticTests/various/decayed_tuple.sol @@ -5,6 +5,7 @@ contract C { return x; } } - +// ==== +// compileViaYul: also // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/various/inline_member_init.sol b/test/libsolidity/semanticTests/various/inline_member_init.sol index 5dca66d80..cac10c786 100644 --- a/test/libsolidity/semanticTests/various/inline_member_init.sol +++ b/test/libsolidity/semanticTests/various/inline_member_init.sol @@ -14,6 +14,7 @@ contract test { c = m_c; } } - +// ==== +// compileViaYul: also // ---- // get() -> 5, 6, 8 diff --git a/test/libsolidity/semanticTests/various/inline_member_init_inheritence.sol b/test/libsolidity/semanticTests/various/inline_member_init_inheritence.sol index 53f5b3718..7ee1028c9 100644 --- a/test/libsolidity/semanticTests/various/inline_member_init_inheritence.sol +++ b/test/libsolidity/semanticTests/various/inline_member_init_inheritence.sol @@ -18,7 +18,8 @@ contract Derived is Base { return m_derived; } } - +// ==== +// compileViaYul: also // ---- // getBMember() -> 5 // getDMember() -> 6 diff --git a/test/libsolidity/semanticTests/various/literal_empty_string.sol b/test/libsolidity/semanticTests/various/literal_empty_string.sol index bf4da5409..ab916ae8c 100644 --- a/test/libsolidity/semanticTests/various/literal_empty_string.sol +++ b/test/libsolidity/semanticTests/various/literal_empty_string.sol @@ -12,6 +12,8 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // x() -> 0 // a() -> 0 diff --git a/test/libsolidity/semanticTests/various/multi_variable_declaration.sol b/test/libsolidity/semanticTests/various/multi_variable_declaration.sol index 6f79442e7..75f3fa724 100644 --- a/test/libsolidity/semanticTests/various/multi_variable_declaration.sol +++ b/test/libsolidity/semanticTests/various/multi_variable_declaration.sol @@ -42,6 +42,7 @@ contract C { return f1() && f2(); } } - +// ==== +// compileViaYul: also // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/various/positive_integers_to_signed.sol b/test/libsolidity/semanticTests/various/positive_integers_to_signed.sol index 9ba67b198..bc5e546ca 100644 --- a/test/libsolidity/semanticTests/various/positive_integers_to_signed.sol +++ b/test/libsolidity/semanticTests/various/positive_integers_to_signed.sol @@ -3,7 +3,8 @@ contract test { int8 public y = 127; int16 public q = 250; } - +// ==== +// compileViaYul: also // ---- // x() -> 2 // y() -> 127 diff --git a/test/libsolidity/semanticTests/various/skip_dynamic_types.sol b/test/libsolidity/semanticTests/various/skip_dynamic_types.sol index 350ea2622..a0231678f 100644 --- a/test/libsolidity/semanticTests/various/skip_dynamic_types.sol +++ b/test/libsolidity/semanticTests/various/skip_dynamic_types.sol @@ -10,6 +10,7 @@ contract C { return (a, b); } } - +// ==== +// compileViaYul: also // ---- // g() -> 7, 8 diff --git a/test/libsolidity/semanticTests/various/storage_string_as_mapping_key_without_variable.sol b/test/libsolidity/semanticTests/various/storage_string_as_mapping_key_without_variable.sol index 7a8a2c276..d5f53c120 100644 --- a/test/libsolidity/semanticTests/various/storage_string_as_mapping_key_without_variable.sol +++ b/test/libsolidity/semanticTests/various/storage_string_as_mapping_key_without_variable.sol @@ -6,6 +6,7 @@ contract Test { return data["abc"]; } } - +// ==== +// compileViaYul: also // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/various/string_tuples.sol b/test/libsolidity/semanticTests/various/string_tuples.sol index 3269d97c0..0a7a38b8b 100644 --- a/test/libsolidity/semanticTests/various/string_tuples.sol +++ b/test/libsolidity/semanticTests/various/string_tuples.sol @@ -11,7 +11,8 @@ contract C { return ("abc"); } } - +// ==== +// compileViaYul: also // ---- // f() -> 0x40, 0x8, 0x3, "abc" // g() -> 0x40, 0x80, 0x3, "abc", 0x3, "def" diff --git a/test/libsolidity/semanticTests/various/test_underscore_in_hex.sol b/test/libsolidity/semanticTests/various/test_underscore_in_hex.sol index 1f12ba390..fae85cd34 100644 --- a/test/libsolidity/semanticTests/various/test_underscore_in_hex.sol +++ b/test/libsolidity/semanticTests/various/test_underscore_in_hex.sol @@ -5,6 +5,8 @@ contract test { return cond ? x : y; } } +// ==== +// compileViaYul: also // ---- // f(bool): true -> 0x1234ab // f(bool): false -> 0x1234abcd1234 diff --git a/test/libsolidity/semanticTests/various/tuples.sol b/test/libsolidity/semanticTests/various/tuples.sol index 00fcd6f9a..b89928a72 100644 --- a/test/libsolidity/semanticTests/various/tuples.sol +++ b/test/libsolidity/semanticTests/various/tuples.sol @@ -25,6 +25,7 @@ contract C { if (a != 8 || b != 10) return 4; } } - +// ==== +// compileViaYul: also // ---- // f() -> 0 diff --git a/test/libsolidity/semanticTests/virtualFunctions/virtual_function_usage_in_constructor_arguments.sol b/test/libsolidity/semanticTests/virtualFunctions/virtual_function_usage_in_constructor_arguments.sol index 590294f15..e66b8ad4f 100644 --- a/test/libsolidity/semanticTests/virtualFunctions/virtual_function_usage_in_constructor_arguments.sol +++ b/test/libsolidity/semanticTests/virtualFunctions/virtual_function_usage_in_constructor_arguments.sol @@ -28,5 +28,7 @@ contract Derived is Base { } } +// ==== +// compileViaYul: also // ---- // getA() -> 2 diff --git a/test/tools/isoltest.cpp b/test/tools/isoltest.cpp index 7a3c63cff..846a54415 100644 --- a/test/tools/isoltest.cpp +++ b/test/tools/isoltest.cpp @@ -161,7 +161,11 @@ TestTool::Result TestTool::process() { (AnsiColorized(cout, formatted, {BOLD}) << m_name << ": ").flush(); - m_test = m_testCaseCreator(TestCase::Config{m_path.string(), m_options.evmVersion()}); + m_test = m_testCaseCreator(TestCase::Config{ + m_path.string(), + m_options.evmVersion(), + m_options.enforceViaYul + }); if (m_test->shouldRun()) switch (TestCase::TestResult result = m_test->run(outputMessages, " ", formatted)) { @@ -232,7 +236,7 @@ TestTool::Request TestTool::handleResponse(bool _exception) cout << endl; ofstream file(m_path.string(), ios::trunc); m_test->printSource(file); - m_test->printSettings(file); + m_test->printUpdatedSettings(file); file << "// ----" << endl; m_test->printUpdatedExpectations(file, "// "); return Request::Rerun;