diff options
Diffstat (limited to 'test')
84 files changed, 1705 insertions, 267 deletions
diff --git a/test/libjulia/CommonSubexpression.cpp b/test/libjulia/CommonSubexpression.cpp new file mode 100644 index 00000000..8a575c48 --- /dev/null +++ b/test/libjulia/CommonSubexpression.cpp @@ -0,0 +1,102 @@ +/* + This file is part of solidity. + + solidity is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + solidity is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solidity. If not, see <http://www.gnu.org/licenses/>. +*/ +/** + * Unit tests for the common subexpression eliminator optimizer stage. + */ + +#include <test/libjulia/Common.h> + +#include <libjulia/optimiser/CommonSubexpressionEliminator.h> + +#include <libsolidity/inlineasm/AsmPrinter.h> + +#include <boost/test/unit_test.hpp> + +#include <boost/range/adaptors.hpp> +#include <boost/algorithm/string/join.hpp> + +using namespace std; +using namespace dev; +using namespace dev::julia; +using namespace dev::julia::test; +using namespace dev::solidity; + + +#define CHECK(_original, _expectation)\ +do\ +{\ + assembly::AsmPrinter p;\ + Block b = disambiguate(_original, false);\ + (CommonSubexpressionEliminator{})(b);\ + string result = p(b);\ + BOOST_CHECK_EQUAL(result, format(_expectation, false));\ +}\ +while(false) + +BOOST_AUTO_TEST_SUITE(IuliaCSE) + +BOOST_AUTO_TEST_CASE(smoke_test) +{ + CHECK("{ }", "{ }"); +} + +BOOST_AUTO_TEST_CASE(trivial) +{ + CHECK( + "{ let a := mul(1, codesize()) let b := mul(1, codesize()) }", + "{ let a := mul(1, codesize()) let b := a }" + ); +} + +BOOST_AUTO_TEST_CASE(non_movable_instr) +{ + CHECK( + "{ let a := mload(1) let b := mload(1) }", + "{ let a := mload(1) let b := mload(1) }" + ); +} + +BOOST_AUTO_TEST_CASE(non_movable_instr2) +{ + CHECK( + "{ let a := gas() let b := gas() }", + "{ let a := gas() let b := gas() }" + ); +} + +BOOST_AUTO_TEST_CASE(branches_if) +{ + CHECK( + "{ let b := 1 if b { b := 1 } let c := 1 }", + "{ let b := 1 if b { b := b } let c := 1 }" + ); +} + +BOOST_AUTO_TEST_CASE(branches_for) +{ + CHECK( + "{ let a := 1 let b := codesize()" + "for { } lt(1, codesize()) { mstore(1, codesize()) a := add(a, codesize()) }" + "{ mstore(1, codesize()) } mstore(1, codesize()) }", + + "{ let a := 1 let b := codesize()" + "for { } lt(1, b) { mstore(1, b) a := add(a, b) }" + "{ mstore(1, b) } mstore(1, b) }" + ); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/test/libsolidity/FormattedScope.h b/test/libsolidity/FormattedScope.h index 78560848..923404f0 100644 --- a/test/libsolidity/FormattedScope.h +++ b/test/libsolidity/FormattedScope.h @@ -38,6 +38,8 @@ static constexpr char const* GREEN = "\033[1;32m"; static constexpr char const* YELLOW = "\033[1;33m"; static constexpr char const* CYAN = "\033[1;36m"; static constexpr char const* BOLD = "\033[1m"; +static constexpr char const* RED_BACKGROUND = "\033[48;5;160m"; +static constexpr char const* ORANGE_BACKGROUND = "\033[48;5;166m"; static constexpr char const* INVERSE = "\033[7m"; } diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp index 34ca33e3..0ced1792 100644 --- a/test/libsolidity/InlineAssembly.cpp +++ b/test/libsolidity/InlineAssembly.cpp @@ -783,6 +783,8 @@ BOOST_AUTO_TEST_CASE(shift) BOOST_AUTO_TEST_CASE(shift_constantinople_warning) { + if (dev::test::Options::get().evmVersion().hasBitwiseShifting()) + return; CHECK_PARSE_WARNING("{ pop(shl(10, 32)) }", Warning, "The \"shl\" instruction is only available for Constantinople-compatible VMs."); CHECK_PARSE_WARNING("{ pop(shr(10, 32)) }", Warning, "The \"shr\" instruction is only available for Constantinople-compatible VMs."); CHECK_PARSE_WARNING("{ pop(sar(10, 32)) }", Warning, "The \"sar\" instruction is only available for Constantinople-compatible VMs."); diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index beeae786..39f4b03e 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -5191,7 +5191,7 @@ BOOST_AUTO_TEST_CASE(pass_dynamic_arguments_to_the_base) } uint public m_i; } - contract Derived is Base(2) { + contract Derived is Base { function Derived(uint i) Base(i) {} } @@ -5211,10 +5211,10 @@ BOOST_AUTO_TEST_CASE(pass_dynamic_arguments_to_the_base_base) } uint public m_i; } - contract Base1 is Base(3) { + contract Base1 is Base { function Base1(uint k) Base(k*k) {} } - contract Derived is Base(3), Base1(2) { + contract Derived is Base, Base1 { function Derived(uint i) Base(i) Base1(i) {} } @@ -5235,7 +5235,7 @@ BOOST_AUTO_TEST_CASE(pass_dynamic_arguments_to_the_base_base_with_gap) uint public m_i; } contract Base1 is Base(3) {} - contract Derived is Base(2), Base1 { + contract Derived is Base, Base1 { function Derived(uint i) Base(i) {} } contract Final is Derived(4) { @@ -11141,6 +11141,135 @@ BOOST_AUTO_TEST_CASE(swap_peephole_optimisation) BOOST_CHECK(callContractFunction("div(uint256,uint256)", u256(0), u256(1)) == encodeArgs(u256(0))); } +BOOST_AUTO_TEST_CASE(bitwise_shifting_constantinople) +{ + if (!dev::test::Options::get().evmVersion().hasBitwiseShifting()) + return; + char const* sourceCode = R"( + contract C { + function shl(uint a, uint b) returns (uint c) { + assembly { + a + b + shl + =: c + } + } + function shr(uint a, uint b) returns (uint c) { + assembly { + a + b + shr + =: c + } + } + function sar(uint a, uint b) returns (uint c) { + assembly { + a + b + sar + =: c + } + } + } + )"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("shl(uint256,uint256)", u256(1), u256(2)) == encodeArgs(u256(4))); + BOOST_CHECK(callContractFunction("shl(uint256,uint256)", u256("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), u256(1)) == encodeArgs(u256("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe"))); + BOOST_CHECK(callContractFunction("shl(uint256,uint256)", u256("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), u256(256)) == encodeArgs(u256(0))); + BOOST_CHECK(callContractFunction("shr(uint256,uint256)", u256(3), u256(1)) == encodeArgs(u256(1))); + BOOST_CHECK(callContractFunction("shr(uint256,uint256)", u256("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), u256(1)) == encodeArgs(u256("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"))); + BOOST_CHECK(callContractFunction("shr(uint256,uint256)", u256("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), u256(255)) == encodeArgs(u256(1))); + BOOST_CHECK(callContractFunction("shr(uint256,uint256)", u256("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), u256(256)) == encodeArgs(u256(0))); + BOOST_CHECK(callContractFunction("sar(uint256,uint256)", u256(3), u256(1)) == encodeArgs(u256(1))); + BOOST_CHECK(callContractFunction("sar(uint256,uint256)", u256("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), u256(1)) == encodeArgs(u256("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"))); + BOOST_CHECK(callContractFunction("sar(uint256,uint256)", u256("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), u256(255)) == encodeArgs(u256("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"))); + BOOST_CHECK(callContractFunction("sar(uint256,uint256)", u256("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), u256(256)) == encodeArgs(u256("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"))); +} + +BOOST_AUTO_TEST_CASE(bitwise_shifting_constants_constantinople) +{ + if (!dev::test::Options::get().evmVersion().hasBitwiseShifting()) + return; + char const* sourceCode = R"( + contract C { + function shl_1() returns (bool) { + uint c; + assembly { + 1 + 2 + shl + =: c + } + assert(c == 4); + return true; + } + function shl_2() returns (bool) { + uint c; + assembly { + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + 1 + shl + =: c + } + assert(c == 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe); + return true; + } + function shl_3() returns (bool) { + uint c; + assembly { + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + 256 + shl + =: c + } + assert(c == 0); + return true; + } + function shr_1() returns (bool) { + uint c; + assembly { + 3 + 1 + shr + =: c + } + assert(c == 1); + return true; + } + function shr_2() returns (bool) { + uint c; + assembly { + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + 1 + shr + =: c + } + assert(c == 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); + return true; + } + function shr_3() returns (bool) { + uint c; + assembly { + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + 256 + shr + =: c + } + assert(c == 0); + return true; + } + } + )"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("shl_1()") == encodeArgs(u256(1))); + BOOST_CHECK(callContractFunction("shl_2()") == encodeArgs(u256(1))); + BOOST_CHECK(callContractFunction("shl_3()") == encodeArgs(u256(1))); + BOOST_CHECK(callContractFunction("shr_1()") == encodeArgs(u256(1))); + BOOST_CHECK(callContractFunction("shr_2()") == encodeArgs(u256(1))); + BOOST_CHECK(callContractFunction("shr_3()") == encodeArgs(u256(1))); +} + BOOST_AUTO_TEST_SUITE_END() } diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index fcee0df3..293f5f44 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -7720,171 +7720,6 @@ BOOST_AUTO_TEST_CASE(address_overload_resolution) CHECK_SUCCESS(text); } -BOOST_AUTO_TEST_CASE(array_length_too_large) -{ - char const* text = R"( - contract C { - uint[8**90] ids; - } - )"; - CHECK_ERROR(text, TypeError, "Invalid array length, expected integer literal or constant expression."); -} - -BOOST_AUTO_TEST_CASE(array_length_not_convertible_to_integer) -{ - char const* text = R"( - contract C { - uint[true] ids; - } - )"; - CHECK_ERROR(text, TypeError, "Invalid array length, expected integer literal or constant expression."); -} - -BOOST_AUTO_TEST_CASE(array_length_constant_var) -{ - char const* text = R"( - contract C { - uint constant LEN = 10; - uint[LEN] ids; - } - )"; - CHECK_SUCCESS(text); -} - -BOOST_AUTO_TEST_CASE(array_length_non_integer_constant_var) -{ - char const* text = R"( - contract C { - bool constant LEN = true; - uint[LEN] ids; - } - )"; - CHECK_ERROR(text, TypeError, "Invalid array length, expected integer literal or constant expression."); -} - -BOOST_AUTO_TEST_CASE(array_length_cannot_be_function) -{ - char const* text = R"( - contract C { - function f() {} - uint[f] ids; - } - )"; - CHECK_ERROR(text, TypeError, "Invalid array length, expected integer literal or constant expression."); -} - -BOOST_AUTO_TEST_CASE(array_length_can_be_recursive_constant) -{ - char const* text = R"( - contract C { - uint constant L = 5; - uint constant LEN = L + 4 * L; - uint[LEN] ids; - } - )"; - CHECK_SUCCESS(text); -} - -BOOST_AUTO_TEST_CASE(array_length_cannot_be_function_call) -{ - char const* text = R"( - contract C { - function f(uint x) {} - uint constant LEN = f(); - uint[LEN] ids; - } - )"; - CHECK_ERROR(text, TypeError, "Invalid array length, expected integer literal or constant expression."); -} - -BOOST_AUTO_TEST_CASE(array_length_const_cannot_be_fractional) -{ - char const* text = R"( - contract C { - fixed constant L = 10.5; - uint[L] ids; - } - )"; - CHECK_ERROR(text, TypeError, "Array with fractional length specified"); -} - -BOOST_AUTO_TEST_CASE(array_length_can_be_constant_in_struct) -{ - char const* text = R"( - contract C { - uint constant LEN = 10; - struct Test { - uint[LEN] ids; - } - } - )"; - CHECK_SUCCESS(text); -} - -BOOST_AUTO_TEST_CASE(array_length_can_be_constant_in_function) -{ - char const* text = R"( - contract C { - uint constant LEN = 10; - function f() { - uint[LEN] a; - } - } - )"; - CHECK_SUCCESS(text); -} - -BOOST_AUTO_TEST_CASE(array_length_cannot_be_constant_function_parameter) -{ - char const* text = R"( - contract C { - function f(uint constant LEN) { - uint[LEN] a; - } - } - )"; - CHECK_ERROR(text, TypeError, "Invalid array length, expected integer literal or constant expression."); -} - -BOOST_AUTO_TEST_CASE(array_length_with_cyclic_constant) -{ - char const* text = R"( - contract C { - uint constant LEN = LEN; - function f() { - uint[LEN] a; - } - } - )"; - CHECK_ERROR(text, TypeError, "Cyclic constant definition (or maximum recursion depth exhausted)."); -} - -BOOST_AUTO_TEST_CASE(array_length_with_complex_cyclic_constant) -{ - char const* text = R"( - contract C { - uint constant L2 = LEN - 10; - uint constant L1 = L2 / 10; - uint constant LEN = 10 + L1 * 5; - function f() { - uint[LEN] a; - } - } - )"; - CHECK_ERROR(text, TypeError, "Cyclic constant definition (or maximum recursion depth exhausted)."); -} - -BOOST_AUTO_TEST_CASE(array_length_with_pure_functions) -{ - char const* text = R"( - contract C { - uint constant LEN = keccak256(ripemd160(33)); - uint[LEN] ids; - } - )"; - CHECK_ERROR(text, TypeError, "Invalid array length, expected integer literal or constant expression."); -} - BOOST_AUTO_TEST_CASE(array_length_invalid_expression) { char const* text = R"( diff --git a/test/libsolidity/SyntaxTest.cpp b/test/libsolidity/SyntaxTest.cpp index 329543bf..1c2355d5 100644 --- a/test/libsolidity/SyntaxTest.cpp +++ b/test/libsolidity/SyntaxTest.cpp @@ -34,17 +34,38 @@ namespace fs = boost::filesystem; using namespace boost::unit_test; template<typename IteratorType> -void skipWhitespace(IteratorType& it, IteratorType end) +void skipWhitespace(IteratorType& _it, IteratorType _end) { - while (it != end && isspace(*it)) - ++it; + while (_it != _end && isspace(*_it)) + ++_it; } template<typename IteratorType> -void skipSlashes(IteratorType& it, IteratorType end) +void skipSlashes(IteratorType& _it, IteratorType _end) { - while (it != end && *it == '/') - ++it; + while (_it != _end && *_it == '/') + ++_it; +} + +void expect(string::iterator& _it, string::iterator _end, string::value_type _c) +{ + if (_it == _end || *_it != _c) + throw runtime_error(string("Invalid test expectation. Expected: \"") + _c + "\"."); + ++_it; +} + +int parseUnsignedInteger(string::iterator &_it, string::iterator _end) +{ + if (_it == _end || !isdigit(*_it)) + throw runtime_error("Invalid test expectation. Source location expected."); + int result = 0; + while (_it != _end && isdigit(*_it)) + { + result *= 10; + result += *_it - '0'; + ++_it; + } + return result; } SyntaxTest::SyntaxTest(string const& _filename) @@ -60,22 +81,39 @@ SyntaxTest::SyntaxTest(string const& _filename) bool SyntaxTest::run(ostream& _stream, string const& _linePrefix, bool const _formatted) { + string const versionPragma = "pragma solidity >=0.0;\n"; m_compiler.reset(); - m_compiler.addSource("", "pragma solidity >=0.0;\n" + m_source); + m_compiler.addSource("", versionPragma + m_source); m_compiler.setEVMVersion(dev::test::Options::get().evmVersion()); if (m_compiler.parse()) m_compiler.analyze(); for (auto const& currentError: filterErrors(m_compiler.errors(), true)) - m_errorList.emplace_back(SyntaxTestError{currentError->typeName(), errorMessage(*currentError)}); + { + int locationStart = -1, locationEnd = -1; + if (auto location = boost::get_error_info<errinfo_sourceLocation>(*currentError)) + { + // ignore the version pragma inserted by the testing tool when calculating locations. + if (location->start >= static_cast<int>(versionPragma.size())) + locationStart = location->start - versionPragma.size(); + if (location->end >= static_cast<int>(versionPragma.size())) + locationEnd = location->end - versionPragma.size(); + } + m_errorList.emplace_back(SyntaxTestError{ + currentError->typeName(), + errorMessage(*currentError), + locationStart, + locationEnd + }); + } if (m_expectations != m_errorList) { string nextIndentLevel = _linePrefix + " "; FormattedScope(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Expected result:" << endl; printErrorList(_stream, m_expectations, nextIndentLevel, _formatted); - FormattedScope(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Obtained result:\n"; + FormattedScope(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Obtained result:" << endl; printErrorList(_stream, m_errorList, nextIndentLevel, _formatted); return false; } @@ -99,6 +137,16 @@ void SyntaxTest::printErrorList( _stream << _linePrefix; _stream << error.type << ": "; } + if (error.locationStart >= 0 || error.locationEnd >= 0) + { + _stream << "("; + if (error.locationStart >= 0) + _stream << error.locationStart; + _stream << "-"; + if (error.locationEnd >= 0) + _stream << error.locationEnd; + _stream << "): "; + } _stream << error.message << endl; } } @@ -147,8 +195,28 @@ vector<SyntaxTestError> SyntaxTest::parseExpectations(istream& _stream) skipWhitespace(it, line.end()); + int locationStart = -1; + int locationEnd = -1; + + if (it != line.end() && *it == '(') + { + ++it; + locationStart = parseUnsignedInteger(it, line.end()); + expect(it, line.end(), '-'); + locationEnd = parseUnsignedInteger(it, line.end()); + expect(it, line.end(), ')'); + expect(it, line.end(), ':'); + } + + skipWhitespace(it, line.end()); + string errorMessage(it, line.end()); - expectations.emplace_back(SyntaxTestError{move(errorType), move(errorMessage)}); + expectations.emplace_back(SyntaxTestError{ + move(errorType), + move(errorMessage), + locationStart, + locationEnd + }); } return expectations; } diff --git a/test/libsolidity/SyntaxTest.h b/test/libsolidity/SyntaxTest.h index dddd86ef..6159e789 100644 --- a/test/libsolidity/SyntaxTest.h +++ b/test/libsolidity/SyntaxTest.h @@ -40,9 +40,14 @@ struct SyntaxTestError { std::string type; std::string message; + int locationStart; + int locationEnd; bool operator==(SyntaxTestError const& _rhs) const { - return type == _rhs.type && message == _rhs.message; + return type == _rhs.type && + message == _rhs.message && + locationStart == _rhs.locationStart && + locationEnd == _rhs.locationEnd; } }; diff --git a/test/libsolidity/syntaxTests/arrayLength/array_length_cannot_be_constant_function_parameter.sol b/test/libsolidity/syntaxTests/arrayLength/array_length_cannot_be_constant_function_parameter.sol new file mode 100644 index 00000000..11d40f26 --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/array_length_cannot_be_constant_function_parameter.sol @@ -0,0 +1,7 @@ +contract C { + function f(uint constant LEN) { + uint[LEN] a; + } +} +// ---- +// TypeError: (62-65): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/arrayLength/can_be_constant_in_function.sol b/test/libsolidity/syntaxTests/arrayLength/can_be_constant_in_function.sol new file mode 100644 index 00000000..92536dd5 --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/can_be_constant_in_function.sol @@ -0,0 +1,8 @@ +contract C { + uint constant LEN = 10; + function f() public pure { + uint[LEN] memory a; + a; + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/arrayLength/can_be_constant_in_struct.sol b/test/libsolidity/syntaxTests/arrayLength/can_be_constant_in_struct.sol new file mode 100644 index 00000000..89e174f2 --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/can_be_constant_in_struct.sol @@ -0,0 +1,7 @@ +contract C { + uint constant LEN = 10; + struct Test { + uint[LEN] ids; + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/arrayLength/can_be_recursive_constant.sol b/test/libsolidity/syntaxTests/arrayLength/can_be_recursive_constant.sol new file mode 100644 index 00000000..6810a9d6 --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/can_be_recursive_constant.sol @@ -0,0 +1,6 @@ +contract C { + uint constant L = 5; + uint constant LEN = L + 4 * L; + uint[LEN] ids; +} +// ---- diff --git a/test/libsolidity/syntaxTests/arrayLength/cannot_be_function.sol b/test/libsolidity/syntaxTests/arrayLength/cannot_be_function.sol new file mode 100644 index 00000000..ac3abc4c --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/cannot_be_function.sol @@ -0,0 +1,6 @@ +contract C { + function f() {} + uint[f] ids; +} +// ---- +// TypeError: (42-43): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/arrayLength/cannot_be_function_call.sol b/test/libsolidity/syntaxTests/arrayLength/cannot_be_function_call.sol new file mode 100644 index 00000000..a6863955 --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/cannot_be_function_call.sol @@ -0,0 +1,7 @@ +contract C { + function f(uint x) {} + uint constant LEN = f(); + uint[LEN] ids; +} +// ---- +// TypeError: (77-80): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/arrayLength/complex_cyclic_constant.sol b/test/libsolidity/syntaxTests/arrayLength/complex_cyclic_constant.sol new file mode 100644 index 00000000..254f9f02 --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/complex_cyclic_constant.sol @@ -0,0 +1,10 @@ +contract C { + uint constant L2 = LEN - 10; + uint constant L1 = L2 / 10; + uint constant LEN = 10 + L1 * 5; + function f() { + uint[LEN] a; + } +} +// ---- +// TypeError: (36-39): Cyclic constant definition (or maximum recursion depth exhausted). diff --git a/test/libsolidity/syntaxTests/arrayLength/const_cannot_be_fractional.sol b/test/libsolidity/syntaxTests/arrayLength/const_cannot_be_fractional.sol new file mode 100644 index 00000000..397bbbcd --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/const_cannot_be_fractional.sol @@ -0,0 +1,6 @@ +contract C { + fixed constant L = 10.5; + uint[L] ids; +} +// ---- +// TypeError: (51-52): Array with fractional length specified. diff --git a/test/libsolidity/syntaxTests/arrayLength/constant_var.sol b/test/libsolidity/syntaxTests/arrayLength/constant_var.sol new file mode 100644 index 00000000..41750250 --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/constant_var.sol @@ -0,0 +1,5 @@ +contract C { + uint constant LEN = 10; + uint[LEN] ids; +} +// ----
\ No newline at end of file diff --git a/test/libsolidity/syntaxTests/arrayLength/cyclic_constant.sol b/test/libsolidity/syntaxTests/arrayLength/cyclic_constant.sol new file mode 100644 index 00000000..91ba9045 --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/cyclic_constant.sol @@ -0,0 +1,8 @@ +contract C { + uint constant LEN = LEN; + function f() { + uint[LEN] a; + } +} +// ---- +// TypeError: (37-40): Cyclic constant definition (or maximum recursion depth exhausted). diff --git a/test/libsolidity/syntaxTests/arrayLength/inline_array.sol b/test/libsolidity/syntaxTests/arrayLength/inline_array.sol new file mode 100644 index 00000000..a30745d3 --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/inline_array.sol @@ -0,0 +1,5 @@ +contract C { + uint[[2]] a15; +} +// ---- +// TypeError: (22-25): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/arrayLength/invalid_expression_1.sol b/test/libsolidity/syntaxTests/arrayLength/invalid_expression_1.sol new file mode 100644 index 00000000..c92861eb --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/invalid_expression_1.sol @@ -0,0 +1,5 @@ +contract C { + uint[-true] ids; +} +// ---- +// TypeError: (22-27): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/arrayLength/invalid_expression_2.sol b/test/libsolidity/syntaxTests/arrayLength/invalid_expression_2.sol new file mode 100644 index 00000000..92e3c3cf --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/invalid_expression_2.sol @@ -0,0 +1,5 @@ +contract C { + uint[true/1] ids; +} +// ---- +// TypeError: (22-28): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/arrayLength/invalid_expression_3.sol b/test/libsolidity/syntaxTests/arrayLength/invalid_expression_3.sol new file mode 100644 index 00000000..26add45c --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/invalid_expression_3.sol @@ -0,0 +1,5 @@ +contract C { + uint[1/true] ids; +} +// ---- +// TypeError: (22-28): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/arrayLength/invalid_expression_4.sol b/test/libsolidity/syntaxTests/arrayLength/invalid_expression_4.sol new file mode 100644 index 00000000..a0d58f4a --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/invalid_expression_4.sol @@ -0,0 +1,5 @@ +contract C { + uint[1.111111E1111111111111] ids; +} +// ---- +// TypeError: (22-44): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/arrayLength/invalid_expression_5.sol b/test/libsolidity/syntaxTests/arrayLength/invalid_expression_5.sol new file mode 100644 index 00000000..38a80867 --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/invalid_expression_5.sol @@ -0,0 +1,5 @@ +contract C { + uint[3/0] ids; +} +// ---- +// TypeError: (22-25): Operator / not compatible with types int_const 3 and int_const 0 diff --git a/test/libsolidity/syntaxTests/arrayLength/non_integer_constant_var.sol b/test/libsolidity/syntaxTests/arrayLength/non_integer_constant_var.sol new file mode 100644 index 00000000..7a853a34 --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/non_integer_constant_var.sol @@ -0,0 +1,6 @@ +contract C { + bool constant LEN = true; + uint[LEN] ids; +} +// ---- +// TypeError: (52-55): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/arrayLength/not_convertible_to_integer.sol b/test/libsolidity/syntaxTests/arrayLength/not_convertible_to_integer.sol new file mode 100644 index 00000000..b44ccfe9 --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/not_convertible_to_integer.sol @@ -0,0 +1,5 @@ +contract C { + uint[true] ids; +} +// ---- +// TypeError: (22-26): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/arrayLength/parentheses.sol b/test/libsolidity/syntaxTests/arrayLength/parentheses.sol new file mode 100644 index 00000000..40f55ad6 --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/parentheses.sol @@ -0,0 +1,25 @@ +contract C { + uint constant L1 = (2); + uint constant L2 = ((2)); + uint constant L3 = ((((2)))); + uint constant L4 = (2 + 1); + uint constant L5 = ((2 + 1)); + uint constant L6 = (((2) + ((1)))); + uint constant L7 = (2 + 1) / 1; + uint constant L8 = (2 + ((1))) / (1); + uint[L1] a1; + uint[L2] a2; + uint[L3] a3; + uint[L4] a4; + uint[L5] a5; + uint[L6] a6; + uint[L7] a7; + uint[L8] a8; + uint[(2)] a9; + uint[(2 + 1)] a10; + uint[(2 + 1) + 1] a11; + uint[((2) + 1) + 1] a12; + uint[(2 + 1) + ((1))] a13; + uint[(((2) + 1)) + (((1)))] a14; + uint[((((2) + 1)) + (((1))))%1] a15; +} diff --git a/test/libsolidity/syntaxTests/arrayLength/pure_functions.sol b/test/libsolidity/syntaxTests/arrayLength/pure_functions.sol new file mode 100644 index 00000000..b620db76 --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/pure_functions.sol @@ -0,0 +1,6 @@ +contract C { + uint constant LEN = keccak256(ripemd160(33)); + uint[LEN] ids; +} +// ---- +// TypeError: (72-75): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/arrayLength/too_large.sol b/test/libsolidity/syntaxTests/arrayLength/too_large.sol new file mode 100644 index 00000000..c90a7494 --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/too_large.sol @@ -0,0 +1,5 @@ +contract C { + uint[8**90] ids; +} +// ---- +// TypeError: (22-27): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/arrayLength/tuples.sol b/test/libsolidity/syntaxTests/arrayLength/tuples.sol new file mode 100644 index 00000000..bc10b3b5 --- /dev/null +++ b/test/libsolidity/syntaxTests/arrayLength/tuples.sol @@ -0,0 +1,5 @@ +contract C { + uint[(1,2)] a15; +} +// ---- +// TypeError: (22-27): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/constants/cyclic_dependency_1.sol b/test/libsolidity/syntaxTests/constants/cyclic_dependency_1.sol index 2b6aa088..cb553fbe 100644 --- a/test/libsolidity/syntaxTests/constants/cyclic_dependency_1.sol +++ b/test/libsolidity/syntaxTests/constants/cyclic_dependency_1.sol @@ -2,4 +2,4 @@ contract C { uint constant a = a; } // ---- -// TypeError: The value of the constant a has a cyclic dependency via a. +// TypeError: (17-36): The value of the constant a has a cyclic dependency via a. diff --git a/test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol b/test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol index 461979f8..00f9bb0f 100644 --- a/test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol +++ b/test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol @@ -5,6 +5,6 @@ contract C { uint constant d = 2 + a; } // ---- -// TypeError: The value of the constant a has a cyclic dependency via c. -// TypeError: The value of the constant c has a cyclic dependency via d. -// TypeError: The value of the constant d has a cyclic dependency via a. +// TypeError: (17-40): The value of the constant a has a cyclic dependency via c. +// TypeError: (71-111): The value of the constant c has a cyclic dependency via d. +// TypeError: (117-140): The value of the constant d has a cyclic dependency via a. diff --git a/test/libsolidity/syntaxTests/constants/cyclic_dependency_3.sol b/test/libsolidity/syntaxTests/constants/cyclic_dependency_3.sol index f63be05e..969ed50d 100644 --- a/test/libsolidity/syntaxTests/constants/cyclic_dependency_3.sol +++ b/test/libsolidity/syntaxTests/constants/cyclic_dependency_3.sol @@ -5,7 +5,7 @@ contract C { uint constant c = b; } // ---- -// TypeError: The value of the constant x has a cyclic dependency via a. -// TypeError: The value of the constant a has a cyclic dependency via b. -// TypeError: The value of the constant b has a cyclic dependency via c. -// TypeError: The value of the constant c has a cyclic dependency via b. +// TypeError: (17-36): The value of the constant x has a cyclic dependency via a. +// TypeError: (42-65): The value of the constant a has a cyclic dependency via b. +// TypeError: (71-90): The value of the constant b has a cyclic dependency via c. +// TypeError: (96-115): The value of the constant c has a cyclic dependency via b. diff --git a/test/libsolidity/syntaxTests/double_stateVariable_declaration.sol b/test/libsolidity/syntaxTests/double_stateVariable_declaration.sol index c5507b64..fda4a17a 100644 --- a/test/libsolidity/syntaxTests/double_stateVariable_declaration.sol +++ b/test/libsolidity/syntaxTests/double_stateVariable_declaration.sol @@ -3,4 +3,4 @@ contract test { uint128 variable; } // ---- -// DeclarationError: Identifier already declared. +// DeclarationError: (36-52): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/double_variable_declaration.sol b/test/libsolidity/syntaxTests/double_variable_declaration.sol index 3349cfec..9ab87959 100644 --- a/test/libsolidity/syntaxTests/double_variable_declaration.sol +++ b/test/libsolidity/syntaxTests/double_variable_declaration.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// DeclarationError: Identifier already declared. +// DeclarationError: (71-80): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/double_variable_declaration_050.sol b/test/libsolidity/syntaxTests/double_variable_declaration_050.sol index 9c2d40d5..2f47e6dc 100644 --- a/test/libsolidity/syntaxTests/double_variable_declaration_050.sol +++ b/test/libsolidity/syntaxTests/double_variable_declaration_050.sol @@ -6,6 +6,6 @@ contract test { } } // ---- -// Warning: This declaration shadows an existing declaration. -// Warning: Unused local variable. -// Warning: Unused local variable. +// Warning: (101-110): This declaration shadows an existing declaration. +// Warning: (76-85): Unused local variable. +// Warning: (101-110): Unused local variable. diff --git a/test/libsolidity/syntaxTests/empty_struct.sol b/test/libsolidity/syntaxTests/empty_struct.sol index dcced618..12655309 100644 --- a/test/libsolidity/syntaxTests/empty_struct.sol +++ b/test/libsolidity/syntaxTests/empty_struct.sol @@ -2,4 +2,4 @@ contract test { struct A {} } // ---- -// Warning: Defining empty structs is deprecated. +// Warning: (17-28): Defining empty structs is deprecated. diff --git a/test/libsolidity/syntaxTests/empty_struct_050.sol b/test/libsolidity/syntaxTests/empty_struct_050.sol index dbec93c4..886f1f83 100644 --- a/test/libsolidity/syntaxTests/empty_struct_050.sol +++ b/test/libsolidity/syntaxTests/empty_struct_050.sol @@ -3,4 +3,4 @@ contract test { struct A {} } // ---- -// SyntaxError: Defining empty structs is disallowed. +// SyntaxError: (47-58): Defining empty structs is disallowed. diff --git a/test/libsolidity/syntaxTests/inheritance/allow_empty_duplicated_super_constructor_call.sol b/test/libsolidity/syntaxTests/inheritance/allow_empty_duplicated_super_constructor_call.sol new file mode 100644 index 00000000..ce9d5f5f --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/allow_empty_duplicated_super_constructor_call.sol @@ -0,0 +1,2 @@ +contract A { constructor() public { } } +contract B is A { constructor() A() public { } } diff --git a/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol b/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol index b3fbd04a..0b18b995 100644 --- a/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol +++ b/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol @@ -4,4 +4,4 @@ contract Base { contract Derived is Base(2) { } contract Derived2 is Base(), Derived() { } // ---- -// Warning: Wrong argument count for constructor call: 0 arguments given but expected 1. +// Warning: (101-107): Wrong argument count for constructor call: 0 arguments given but expected 1. diff --git a/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses_V050.sol b/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses_V050.sol index b3728634..db04ab8c 100644 --- a/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses_V050.sol +++ b/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses_V050.sol @@ -6,4 +6,4 @@ contract Base { contract Derived is Base(2) { } contract Derived2 is Base(), Derived() { } // ---- -// TypeError: Wrong argument count for constructor call: 0 arguments given but expected 1. +// TypeError: (132-138): Wrong argument count for constructor call: 0 arguments given but expected 1. diff --git a/test/libsolidity/syntaxTests/inheritance/base_arguments_multiple_inheritance.sol b/test/libsolidity/syntaxTests/inheritance/base_arguments_multiple_inheritance.sol new file mode 100644 index 00000000..015b33e5 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/base_arguments_multiple_inheritance.sol @@ -0,0 +1,9 @@ +contract Base { + constructor(uint) public { } +} +contract Base1 is Base(3) {} +contract Derived is Base, Base1 { + constructor(uint i) Base(i) public {} +} +// ---- +// Warning: (138-145): Base constructor arguments given twice. diff --git a/test/libsolidity/syntaxTests/inheritance/disallow_modifier_style_without_parentheses.sol b/test/libsolidity/syntaxTests/inheritance/disallow_modifier_style_without_parentheses.sol new file mode 100644 index 00000000..6cf68d2a --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/disallow_modifier_style_without_parentheses.sol @@ -0,0 +1,4 @@ +contract A { constructor() public { } } +contract B is A { constructor() A public { } } +// ---- +// Warning: (72-73): Modifier-style base constructor call without arguments. diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor.sol new file mode 100644 index 00000000..24cff54d --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor.sol @@ -0,0 +1,5 @@ +contract A { constructor(uint) public { } } +contract B is A(2) { constructor() public { } } +contract C is B { constructor() A(3) public { } } +// ---- +// Warning: (125-129): Base constructor arguments given twice. diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor_V050.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor_V050.sol new file mode 100644 index 00000000..8d5df5bf --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/ancestor_V050.sol @@ -0,0 +1,7 @@ +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.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base.sol new file mode 100644 index 00000000..9ceaea5e --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base.sol @@ -0,0 +1,4 @@ +contract A { constructor(uint) public { } } +contract B is A(2) { constructor() A(3) public { } } +// ---- +// Warning: (79-83): 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 new file mode 100644 index 00000000..f9325f99 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_V050.sol @@ -0,0 +1,6 @@ +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/inheritance/duplicated_constructor_call/base_multi.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi.sol new file mode 100644 index 00000000..e5c2aa36 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi.sol @@ -0,0 +1,7 @@ +contract C { constructor(uint) public {} } +contract A is C(2) {} +contract B is C(2) {} +contract D is A, B { constructor() C(3) public {} } +// ---- +// Warning: (122-126): Base constructor arguments given twice. +// Warning: (122-126): Base constructor arguments given twice. diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor.sol new file mode 100644 index 00000000..1abf2992 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor.sol @@ -0,0 +1,6 @@ +contract C { constructor(uint) public {} } +contract A is C(2) {} +contract B is C(2) {} +contract D is A, B {} +// ---- +// Warning: (87-108): Base constructor arguments given twice. diff --git a/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor_modifier_style.sol b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor_modifier_style.sol new file mode 100644 index 00000000..e15242db --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base_multi_no_constructor_modifier_style.sol @@ -0,0 +1,6 @@ +contract C { constructor(uint) public {} } +contract A is C { constructor() C(2) public {} } +contract B is C { constructor() C(2) public {} } +contract D is A, B { } +// ---- +// Warning: (141-163): Base constructor arguments given twice. diff --git a/test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol b/test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol index 45a0770f..c55c41f2 100644 --- a/test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol +++ b/test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol @@ -6,5 +6,5 @@ contract Derived2 is Base { constructor() Base(2) public { } } // ---- -// TypeError: Wrong argument count for constructor call: 1 arguments given but expected 2. -// TypeError: Wrong argument count for modifier invocation: 1 arguments given but expected 2. +// TypeError: (74-81): Wrong argument count for constructor call: 1 arguments given but expected 2. +// TypeError: (130-137): Wrong argument count for modifier invocation: 1 arguments given but expected 2. diff --git a/test/libsolidity/syntaxTests/literal_comparisons.sol b/test/libsolidity/syntaxTests/literal_comparisons.sol new file mode 100644 index 00000000..dd2afcaa --- /dev/null +++ b/test/libsolidity/syntaxTests/literal_comparisons.sol @@ -0,0 +1,7 @@ +contract test { + function f(int8 x) public pure { + if (x == 1) {} + if (1 == x) {} + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/more_than_256_declarationerrors.sol b/test/libsolidity/syntaxTests/more_than_256_declarationerrors.sol new file mode 100644 index 00000000..2d75f29b --- /dev/null +++ b/test/libsolidity/syntaxTests/more_than_256_declarationerrors.sol @@ -0,0 +1,524 @@ +contract C { + function f() { + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + b = 5; + } +} +// ---- +// DeclarationError: (34-35): Undeclared identifier. +// DeclarationError: (45-46): Undeclared identifier. +// DeclarationError: (56-57): Undeclared identifier. +// DeclarationError: (67-68): Undeclared identifier. +// DeclarationError: (78-79): Undeclared identifier. +// DeclarationError: (89-90): Undeclared identifier. +// DeclarationError: (100-101): Undeclared identifier. +// DeclarationError: (111-112): Undeclared identifier. +// DeclarationError: (122-123): Undeclared identifier. +// DeclarationError: (133-134): Undeclared identifier. +// DeclarationError: (144-145): Undeclared identifier. +// DeclarationError: (155-156): Undeclared identifier. +// DeclarationError: (166-167): Undeclared identifier. +// DeclarationError: (177-178): Undeclared identifier. +// DeclarationError: (188-189): Undeclared identifier. +// DeclarationError: (199-200): Undeclared identifier. +// DeclarationError: (210-211): Undeclared identifier. +// DeclarationError: (221-222): Undeclared identifier. +// DeclarationError: (232-233): Undeclared identifier. +// DeclarationError: (243-244): Undeclared identifier. +// DeclarationError: (254-255): Undeclared identifier. +// DeclarationError: (265-266): Undeclared identifier. +// DeclarationError: (276-277): Undeclared identifier. +// DeclarationError: (287-288): Undeclared identifier. +// DeclarationError: (298-299): Undeclared identifier. +// DeclarationError: (309-310): Undeclared identifier. +// DeclarationError: (320-321): Undeclared identifier. +// DeclarationError: (331-332): Undeclared identifier. +// DeclarationError: (342-343): Undeclared identifier. +// DeclarationError: (353-354): Undeclared identifier. +// DeclarationError: (364-365): Undeclared identifier. +// DeclarationError: (375-376): Undeclared identifier. +// DeclarationError: (386-387): Undeclared identifier. +// DeclarationError: (397-398): Undeclared identifier. +// DeclarationError: (408-409): Undeclared identifier. +// DeclarationError: (419-420): Undeclared identifier. +// DeclarationError: (430-431): Undeclared identifier. +// DeclarationError: (441-442): Undeclared identifier. +// DeclarationError: (452-453): Undeclared identifier. +// DeclarationError: (463-464): Undeclared identifier. +// DeclarationError: (474-475): Undeclared identifier. +// DeclarationError: (485-486): Undeclared identifier. +// DeclarationError: (496-497): Undeclared identifier. +// DeclarationError: (507-508): Undeclared identifier. +// DeclarationError: (518-519): Undeclared identifier. +// DeclarationError: (529-530): Undeclared identifier. +// DeclarationError: (540-541): Undeclared identifier. +// DeclarationError: (551-552): Undeclared identifier. +// DeclarationError: (562-563): Undeclared identifier. +// DeclarationError: (573-574): Undeclared identifier. +// DeclarationError: (584-585): Undeclared identifier. +// DeclarationError: (595-596): Undeclared identifier. +// DeclarationError: (606-607): Undeclared identifier. +// DeclarationError: (617-618): Undeclared identifier. +// DeclarationError: (628-629): Undeclared identifier. +// DeclarationError: (639-640): Undeclared identifier. +// DeclarationError: (650-651): Undeclared identifier. +// DeclarationError: (661-662): Undeclared identifier. +// DeclarationError: (672-673): Undeclared identifier. +// DeclarationError: (683-684): Undeclared identifier. +// DeclarationError: (694-695): Undeclared identifier. +// DeclarationError: (705-706): Undeclared identifier. +// DeclarationError: (716-717): Undeclared identifier. +// DeclarationError: (727-728): Undeclared identifier. +// DeclarationError: (738-739): Undeclared identifier. +// DeclarationError: (749-750): Undeclared identifier. +// DeclarationError: (760-761): Undeclared identifier. +// DeclarationError: (771-772): Undeclared identifier. +// DeclarationError: (782-783): Undeclared identifier. +// DeclarationError: (793-794): Undeclared identifier. +// DeclarationError: (804-805): Undeclared identifier. +// DeclarationError: (815-816): Undeclared identifier. +// DeclarationError: (826-827): Undeclared identifier. +// DeclarationError: (837-838): Undeclared identifier. +// DeclarationError: (848-849): Undeclared identifier. +// DeclarationError: (859-860): Undeclared identifier. +// DeclarationError: (870-871): Undeclared identifier. +// DeclarationError: (881-882): Undeclared identifier. +// DeclarationError: (892-893): Undeclared identifier. +// DeclarationError: (903-904): Undeclared identifier. +// DeclarationError: (914-915): Undeclared identifier. +// DeclarationError: (925-926): Undeclared identifier. +// DeclarationError: (936-937): Undeclared identifier. +// DeclarationError: (947-948): Undeclared identifier. +// DeclarationError: (958-959): Undeclared identifier. +// DeclarationError: (969-970): Undeclared identifier. +// DeclarationError: (980-981): Undeclared identifier. +// DeclarationError: (991-992): Undeclared identifier. +// DeclarationError: (1002-1003): Undeclared identifier. +// DeclarationError: (1013-1014): Undeclared identifier. +// DeclarationError: (1024-1025): Undeclared identifier. +// DeclarationError: (1035-1036): Undeclared identifier. +// DeclarationError: (1046-1047): Undeclared identifier. +// DeclarationError: (1057-1058): Undeclared identifier. +// DeclarationError: (1068-1069): Undeclared identifier. +// DeclarationError: (1079-1080): Undeclared identifier. +// DeclarationError: (1090-1091): Undeclared identifier. +// DeclarationError: (1101-1102): Undeclared identifier. +// DeclarationError: (1112-1113): Undeclared identifier. +// DeclarationError: (1123-1124): Undeclared identifier. +// DeclarationError: (1134-1135): Undeclared identifier. +// DeclarationError: (1145-1146): Undeclared identifier. +// DeclarationError: (1156-1157): Undeclared identifier. +// DeclarationError: (1167-1168): Undeclared identifier. +// DeclarationError: (1178-1179): Undeclared identifier. +// DeclarationError: (1189-1190): Undeclared identifier. +// DeclarationError: (1200-1201): Undeclared identifier. +// DeclarationError: (1211-1212): Undeclared identifier. +// DeclarationError: (1222-1223): Undeclared identifier. +// DeclarationError: (1233-1234): Undeclared identifier. +// DeclarationError: (1244-1245): Undeclared identifier. +// DeclarationError: (1255-1256): Undeclared identifier. +// DeclarationError: (1266-1267): Undeclared identifier. +// DeclarationError: (1277-1278): Undeclared identifier. +// DeclarationError: (1288-1289): Undeclared identifier. +// DeclarationError: (1299-1300): Undeclared identifier. +// DeclarationError: (1310-1311): Undeclared identifier. +// DeclarationError: (1321-1322): Undeclared identifier. +// DeclarationError: (1332-1333): Undeclared identifier. +// DeclarationError: (1343-1344): Undeclared identifier. +// DeclarationError: (1354-1355): Undeclared identifier. +// DeclarationError: (1365-1366): Undeclared identifier. +// DeclarationError: (1376-1377): Undeclared identifier. +// DeclarationError: (1387-1388): Undeclared identifier. +// DeclarationError: (1398-1399): Undeclared identifier. +// DeclarationError: (1409-1410): Undeclared identifier. +// DeclarationError: (1420-1421): Undeclared identifier. +// DeclarationError: (1431-1432): Undeclared identifier. +// DeclarationError: (1442-1443): Undeclared identifier. +// DeclarationError: (1453-1454): Undeclared identifier. +// DeclarationError: (1464-1465): Undeclared identifier. +// DeclarationError: (1475-1476): Undeclared identifier. +// DeclarationError: (1486-1487): Undeclared identifier. +// DeclarationError: (1497-1498): Undeclared identifier. +// DeclarationError: (1508-1509): Undeclared identifier. +// DeclarationError: (1519-1520): Undeclared identifier. +// DeclarationError: (1530-1531): Undeclared identifier. +// DeclarationError: (1541-1542): Undeclared identifier. +// DeclarationError: (1552-1553): Undeclared identifier. +// DeclarationError: (1563-1564): Undeclared identifier. +// DeclarationError: (1574-1575): Undeclared identifier. +// DeclarationError: (1585-1586): Undeclared identifier. +// DeclarationError: (1596-1597): Undeclared identifier. +// DeclarationError: (1607-1608): Undeclared identifier. +// DeclarationError: (1618-1619): Undeclared identifier. +// DeclarationError: (1629-1630): Undeclared identifier. +// DeclarationError: (1640-1641): Undeclared identifier. +// DeclarationError: (1651-1652): Undeclared identifier. +// DeclarationError: (1662-1663): Undeclared identifier. +// DeclarationError: (1673-1674): Undeclared identifier. +// DeclarationError: (1684-1685): Undeclared identifier. +// DeclarationError: (1695-1696): Undeclared identifier. +// DeclarationError: (1706-1707): Undeclared identifier. +// DeclarationError: (1717-1718): Undeclared identifier. +// DeclarationError: (1728-1729): Undeclared identifier. +// DeclarationError: (1739-1740): Undeclared identifier. +// DeclarationError: (1750-1751): Undeclared identifier. +// DeclarationError: (1761-1762): Undeclared identifier. +// DeclarationError: (1772-1773): Undeclared identifier. +// DeclarationError: (1783-1784): Undeclared identifier. +// DeclarationError: (1794-1795): Undeclared identifier. +// DeclarationError: (1805-1806): Undeclared identifier. +// DeclarationError: (1816-1817): Undeclared identifier. +// DeclarationError: (1827-1828): Undeclared identifier. +// DeclarationError: (1838-1839): Undeclared identifier. +// DeclarationError: (1849-1850): Undeclared identifier. +// DeclarationError: (1860-1861): Undeclared identifier. +// DeclarationError: (1871-1872): Undeclared identifier. +// DeclarationError: (1882-1883): Undeclared identifier. +// DeclarationError: (1893-1894): Undeclared identifier. +// DeclarationError: (1904-1905): Undeclared identifier. +// DeclarationError: (1915-1916): Undeclared identifier. +// DeclarationError: (1926-1927): Undeclared identifier. +// DeclarationError: (1937-1938): Undeclared identifier. +// DeclarationError: (1948-1949): Undeclared identifier. +// DeclarationError: (1959-1960): Undeclared identifier. +// DeclarationError: (1970-1971): Undeclared identifier. +// DeclarationError: (1981-1982): Undeclared identifier. +// DeclarationError: (1992-1993): Undeclared identifier. +// DeclarationError: (2003-2004): Undeclared identifier. +// DeclarationError: (2014-2015): Undeclared identifier. +// DeclarationError: (2025-2026): Undeclared identifier. +// DeclarationError: (2036-2037): Undeclared identifier. +// DeclarationError: (2047-2048): Undeclared identifier. +// DeclarationError: (2058-2059): Undeclared identifier. +// DeclarationError: (2069-2070): Undeclared identifier. +// DeclarationError: (2080-2081): Undeclared identifier. +// DeclarationError: (2091-2092): Undeclared identifier. +// DeclarationError: (2102-2103): Undeclared identifier. +// DeclarationError: (2113-2114): Undeclared identifier. +// DeclarationError: (2124-2125): Undeclared identifier. +// DeclarationError: (2135-2136): Undeclared identifier. +// DeclarationError: (2146-2147): Undeclared identifier. +// DeclarationError: (2157-2158): Undeclared identifier. +// DeclarationError: (2168-2169): Undeclared identifier. +// DeclarationError: (2179-2180): Undeclared identifier. +// DeclarationError: (2190-2191): Undeclared identifier. +// DeclarationError: (2201-2202): Undeclared identifier. +// DeclarationError: (2212-2213): Undeclared identifier. +// DeclarationError: (2223-2224): Undeclared identifier. +// DeclarationError: (2234-2235): Undeclared identifier. +// DeclarationError: (2245-2246): Undeclared identifier. +// DeclarationError: (2256-2257): Undeclared identifier. +// DeclarationError: (2267-2268): Undeclared identifier. +// DeclarationError: (2278-2279): Undeclared identifier. +// DeclarationError: (2289-2290): Undeclared identifier. +// DeclarationError: (2300-2301): Undeclared identifier. +// DeclarationError: (2311-2312): Undeclared identifier. +// DeclarationError: (2322-2323): Undeclared identifier. +// DeclarationError: (2333-2334): Undeclared identifier. +// DeclarationError: (2344-2345): Undeclared identifier. +// DeclarationError: (2355-2356): Undeclared identifier. +// DeclarationError: (2366-2367): Undeclared identifier. +// DeclarationError: (2377-2378): Undeclared identifier. +// DeclarationError: (2388-2389): Undeclared identifier. +// DeclarationError: (2399-2400): Undeclared identifier. +// DeclarationError: (2410-2411): Undeclared identifier. +// DeclarationError: (2421-2422): Undeclared identifier. +// DeclarationError: (2432-2433): Undeclared identifier. +// DeclarationError: (2443-2444): Undeclared identifier. +// DeclarationError: (2454-2455): Undeclared identifier. +// DeclarationError: (2465-2466): Undeclared identifier. +// DeclarationError: (2476-2477): Undeclared identifier. +// DeclarationError: (2487-2488): Undeclared identifier. +// DeclarationError: (2498-2499): Undeclared identifier. +// DeclarationError: (2509-2510): Undeclared identifier. +// DeclarationError: (2520-2521): Undeclared identifier. +// DeclarationError: (2531-2532): Undeclared identifier. +// DeclarationError: (2542-2543): Undeclared identifier. +// DeclarationError: (2553-2554): Undeclared identifier. +// DeclarationError: (2564-2565): Undeclared identifier. +// DeclarationError: (2575-2576): Undeclared identifier. +// DeclarationError: (2586-2587): Undeclared identifier. +// DeclarationError: (2597-2598): Undeclared identifier. +// DeclarationError: (2608-2609): Undeclared identifier. +// DeclarationError: (2619-2620): Undeclared identifier. +// DeclarationError: (2630-2631): Undeclared identifier. +// DeclarationError: (2641-2642): Undeclared identifier. +// DeclarationError: (2652-2653): Undeclared identifier. +// DeclarationError: (2663-2664): Undeclared identifier. +// DeclarationError: (2674-2675): Undeclared identifier. +// DeclarationError: (2685-2686): Undeclared identifier. +// DeclarationError: (2696-2697): Undeclared identifier. +// DeclarationError: (2707-2708): Undeclared identifier. +// DeclarationError: (2718-2719): Undeclared identifier. +// DeclarationError: (2729-2730): Undeclared identifier. +// DeclarationError: (2740-2741): Undeclared identifier. +// DeclarationError: (2751-2752): Undeclared identifier. +// DeclarationError: (2762-2763): Undeclared identifier. +// DeclarationError: (2773-2774): Undeclared identifier. +// DeclarationError: (2784-2785): Undeclared identifier. +// DeclarationError: (2795-2796): Undeclared identifier. +// DeclarationError: (2806-2807): Undeclared identifier. +// DeclarationError: (2817-2818): Undeclared identifier. +// DeclarationError: (2828-2829): Undeclared identifier. +// DeclarationError: (2839-2840): Undeclared identifier. +// Warning: There are more than 256 errors. Aborting. diff --git a/test/libsolidity/syntaxTests/more_than_256_syntaxerrors.sol b/test/libsolidity/syntaxTests/more_than_256_syntaxerrors.sol new file mode 100644 index 00000000..2c9b8a42 --- /dev/null +++ b/test/libsolidity/syntaxTests/more_than_256_syntaxerrors.sol @@ -0,0 +1,524 @@ +contract C { + function f() { + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + continue; + } +} +// ---- +// SyntaxError: (34-42): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (48-56): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (62-70): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (76-84): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (90-98): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (104-112): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (118-126): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (132-140): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (146-154): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (160-168): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (174-182): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (188-196): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (202-210): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (216-224): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (230-238): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (244-252): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (258-266): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (272-280): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (286-294): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (300-308): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (314-322): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (328-336): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (342-350): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (356-364): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (370-378): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (384-392): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (398-406): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (412-420): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (426-434): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (440-448): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (454-462): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (468-476): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (482-490): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (496-504): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (510-518): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (524-532): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (538-546): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (552-560): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (566-574): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (580-588): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (594-602): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (608-616): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (622-630): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (636-644): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (650-658): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (664-672): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (678-686): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (692-700): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (706-714): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (720-728): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (734-742): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (748-756): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (762-770): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (776-784): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (790-798): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (804-812): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (818-826): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (832-840): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (846-854): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (860-868): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (874-882): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (888-896): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (902-910): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (916-924): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (930-938): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (944-952): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (958-966): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (972-980): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (986-994): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1000-1008): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1014-1022): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1028-1036): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1042-1050): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1056-1064): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1070-1078): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1084-1092): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1098-1106): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1112-1120): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1126-1134): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1140-1148): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1154-1162): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1168-1176): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1182-1190): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1196-1204): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1210-1218): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1224-1232): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1238-1246): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1252-1260): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1266-1274): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1280-1288): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1294-1302): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1308-1316): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1322-1330): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1336-1344): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1350-1358): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1364-1372): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1378-1386): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1392-1400): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1406-1414): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1420-1428): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1434-1442): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1448-1456): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1462-1470): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1476-1484): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1490-1498): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1504-1512): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1518-1526): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1532-1540): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1546-1554): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1560-1568): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1574-1582): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1588-1596): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1602-1610): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1616-1624): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1630-1638): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1644-1652): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1658-1666): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1672-1680): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1686-1694): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1700-1708): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1714-1722): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1728-1736): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1742-1750): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1756-1764): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1770-1778): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1784-1792): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1798-1806): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1812-1820): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1826-1834): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1840-1848): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1854-1862): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1868-1876): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1882-1890): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1896-1904): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1910-1918): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1924-1932): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1938-1946): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1952-1960): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1966-1974): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1980-1988): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (1994-2002): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2008-2016): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2022-2030): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2036-2044): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2050-2058): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2064-2072): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2078-2086): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2092-2100): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2106-2114): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2120-2128): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2134-2142): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2148-2156): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2162-2170): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2176-2184): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2190-2198): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2204-2212): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2218-2226): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2232-2240): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2246-2254): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2260-2268): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2274-2282): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2288-2296): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2302-2310): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2316-2324): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2330-2338): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2344-2352): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2358-2366): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2372-2380): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2386-2394): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2400-2408): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2414-2422): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2428-2436): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2442-2450): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2456-2464): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2470-2478): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2484-2492): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2498-2506): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2512-2520): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2526-2534): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2540-2548): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2554-2562): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2568-2576): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2582-2590): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2596-2604): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2610-2618): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2624-2632): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2638-2646): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2652-2660): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2666-2674): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2680-2688): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2694-2702): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2708-2716): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2722-2730): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2736-2744): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2750-2758): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2764-2772): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2778-2786): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2792-2800): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2806-2814): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2820-2828): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2834-2842): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2848-2856): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2862-2870): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2876-2884): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2890-2898): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2904-2912): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2918-2926): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2932-2940): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2946-2954): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2960-2968): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2974-2982): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (2988-2996): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3002-3010): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3016-3024): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3030-3038): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3044-3052): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3058-3066): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3072-3080): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3086-3094): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3100-3108): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3114-3122): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3128-3136): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3142-3150): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3156-3164): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3170-3178): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3184-3192): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3198-3206): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3212-3220): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3226-3234): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3240-3248): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3254-3262): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3268-3276): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3282-3290): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3296-3304): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3310-3318): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3324-3332): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3338-3346): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3352-3360): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3366-3374): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3380-3388): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3394-3402): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3408-3416): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3422-3430): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3436-3444): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3450-3458): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3464-3472): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3478-3486): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3492-3500): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3506-3514): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3520-3528): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3534-3542): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3548-3556): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3562-3570): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3576-3584): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3590-3598): "continue" has to be in a "for" or "while" loop. +// SyntaxError: (3604-3612): "continue" has to be in a "for" or "while" loop. +// Warning: There are more than 256 errors. Aborting. diff --git a/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol b/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol index c03fd97d..fd3067e3 100644 --- a/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol +++ b/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol @@ -2,4 +2,4 @@ contract test { uint256 ; } // ---- -// ParserError: Expected identifier, got 'Semicolon' +// ParserError: (28-28): Expected identifier, got 'Semicolon' diff --git a/test/libsolidity/syntaxTests/scoping/double_function_declaration.sol b/test/libsolidity/syntaxTests/scoping/double_function_declaration.sol index 2841fd38..dfd67aaa 100644 --- a/test/libsolidity/syntaxTests/scoping/double_function_declaration.sol +++ b/test/libsolidity/syntaxTests/scoping/double_function_declaration.sol @@ -3,4 +3,4 @@ contract test { function fun() public { } } // ---- -// DeclarationError: Function with same name and arguments defined twice. +// DeclarationError: (20-45): Function with same name and arguments defined twice. diff --git a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope.sol b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope.sol index ea61d0f3..d90ec2d7 100644 --- a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope.sol +++ b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// DeclarationError: Identifier already declared. +// DeclarationError: (77-83): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_050.sol b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_050.sol index 22195963..06bfe7be 100644 --- a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_050.sol +++ b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_050.sol @@ -6,5 +6,5 @@ contract test { } } // ---- -// Warning: Unused local variable. -// Warning: Unused local variable. +// Warning: (87-93): Unused local variable. +// Warning: (107-113): Unused local variable. diff --git a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation.sol b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation.sol index 6af89c93..1a5ff2f9 100644 --- a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation.sol +++ b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// DeclarationError: Identifier already declared. +// DeclarationError: (75-81): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation_050.sol b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation_050.sol index 73cddfed..20ea0349 100644 --- a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation_050.sol +++ b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_disjoint_scope_activation_050.sol @@ -6,5 +6,5 @@ contract test { } } // ---- -// Warning: Unused local variable. -// Warning: Unused local variable. +// Warning: (87-93): Unused local variable. +// Warning: (105-111): Unused local variable. diff --git a/test/libsolidity/syntaxTests/scoping/name_shadowing.sol b/test/libsolidity/syntaxTests/scoping/name_shadowing.sol index d16877f9..67ada4a4 100644 --- a/test/libsolidity/syntaxTests/scoping/name_shadowing.sol +++ b/test/libsolidity/syntaxTests/scoping/name_shadowing.sol @@ -3,5 +3,4 @@ contract test { function f() pure public { uint32 variable; variable = 2; } } // ---- -// Warning: This declaration shadows an existing declaration. - +// Warning: (69-84): This declaration shadows an existing declaration. diff --git a/test/libsolidity/syntaxTests/scoping/scoping.sol b/test/libsolidity/syntaxTests/scoping/scoping.sol index f47a3e99..34b055d9 100644 --- a/test/libsolidity/syntaxTests/scoping/scoping.sol +++ b/test/libsolidity/syntaxTests/scoping/scoping.sol @@ -8,4 +8,4 @@ contract test { } } // ---- -// DeclarationError: Undeclared identifier. +// DeclarationError: (123-124): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/scoping/scoping_activation.sol b/test/libsolidity/syntaxTests/scoping/scoping_activation.sol index 0ed74a00..7334bc49 100644 --- a/test/libsolidity/syntaxTests/scoping/scoping_activation.sol +++ b/test/libsolidity/syntaxTests/scoping/scoping_activation.sol @@ -6,4 +6,4 @@ contract test { } } // ---- -// DeclarationError: Undeclared identifier. Did you mean "x"? +// DeclarationError: (85-86): Undeclared identifier. Did you mean "x"? diff --git a/test/libsolidity/syntaxTests/scoping/scoping_for3.sol b/test/libsolidity/syntaxTests/scoping/scoping_for3.sol index 9bc7d569..1814cb47 100644 --- a/test/libsolidity/syntaxTests/scoping/scoping_for3.sol +++ b/test/libsolidity/syntaxTests/scoping/scoping_for3.sol @@ -8,4 +8,4 @@ contract test { } } // ---- -// DeclarationError: Undeclared identifier. +// DeclarationError: (154-155): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/scoping/scoping_for_decl_in_body.sol b/test/libsolidity/syntaxTests/scoping/scoping_for_decl_in_body.sol index 07503983..3e80b385 100644 --- a/test/libsolidity/syntaxTests/scoping/scoping_for_decl_in_body.sol +++ b/test/libsolidity/syntaxTests/scoping/scoping_for_decl_in_body.sol @@ -7,4 +7,4 @@ contract test { } } // ---- -// DeclarationError: Undeclared identifier. +// DeclarationError: (93-94): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/scoping/scoping_self_use_050.sol b/test/libsolidity/syntaxTests/scoping/scoping_self_use_050.sol index e942020e..ab3dcefb 100644 --- a/test/libsolidity/syntaxTests/scoping/scoping_self_use_050.sol +++ b/test/libsolidity/syntaxTests/scoping/scoping_self_use_050.sol @@ -5,4 +5,4 @@ contract test { } } // ---- -// DeclarationError: Undeclared identifier. Did you mean "a"? +// DeclarationError: (94-95): Undeclared identifier. Did you mean "a"? diff --git a/test/libsolidity/syntaxTests/smoke_test.sol b/test/libsolidity/syntaxTests/smoke_test.sol index 2d48098a..6abaff18 100644 --- a/test/libsolidity/syntaxTests/smoke_test.sol +++ b/test/libsolidity/syntaxTests/smoke_test.sol @@ -3,4 +3,4 @@ contract test { function fun(uint256 arg1) public { uint256 y; y = arg1; } } // ---- -// Warning: Function state mutability can be restricted to pure +// Warning: (42-100): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol index 9f57c3a4..c98d7a57 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol @@ -5,7 +5,7 @@ contract C { } } // ---- -// TypeError: This type cannot be encoded. -// TypeError: This type cannot be encoded. -// TypeError: This type cannot be encoded. -// TypeError: This type cannot be encoded. +// TypeError: (74-83): This type cannot be encoded. +// TypeError: (85-86): This type cannot be encoded. +// TypeError: (88-98): This type cannot be encoded. +// TypeError: (100-115): This type cannot be encoded. diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_special_types.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_special_types.sol index a7d13215..f1b5606e 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_special_types.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_special_types.sol @@ -6,8 +6,8 @@ contract C { } } // ---- -// TypeError: This type cannot be encoded. -// TypeError: This type cannot be encoded. -// TypeError: This type cannot be encoded. -// TypeError: This type cannot be encoded. -// TypeError: This type cannot be encoded. +// TypeError: (80-106): This type cannot be encoded. +// TypeError: (108-113): This type cannot be encoded. +// TypeError: (160-164): This type cannot be encoded. +// TypeError: (166-168): This type cannot be encoded. +// TypeError: (170-176): This type cannot be encoded. diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol index 378155e9..cc354819 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol @@ -9,6 +9,6 @@ contract C { } } // ---- -// Warning: Defining empty structs is deprecated. -// TypeError: This type cannot be encoded. -// TypeError: This type cannot be encoded. +// Warning: (51-63): Defining empty structs is deprecated. +// TypeError: (131-132): This type cannot be encoded. +// TypeError: (134-135): This type cannot be encoded. diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_types.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_types.sol index 6e073fd8..d10c1718 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_types.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_types.sol @@ -9,9 +9,9 @@ contract C { } } // ---- -// Warning: Defining empty structs is deprecated. -// TypeError: This type cannot be encoded. -// TypeError: This type cannot be encoded. -// TypeError: This type cannot be encoded. -// TypeError: This type cannot be encoded. -// TypeError: This type cannot be encoded. +// Warning: (51-63): Defining empty structs is deprecated. +// TypeError: (168-169): This type cannot be encoded. +// TypeError: (171-172): This type cannot be encoded. +// TypeError: (179-180): This type cannot be encoded. +// TypeError: (182-186): This type cannot be encoded. +// TypeError: (188-194): This type cannot be encoded. diff --git a/test/libsolidity/syntaxTests/structs/recursion/multi_struct_composition.sol b/test/libsolidity/syntaxTests/structs/recursion/multi_struct_composition.sol index 9a1c22f1..895bb6c5 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/multi_struct_composition.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/multi_struct_composition.sol @@ -12,4 +12,4 @@ contract C { function f(T) public pure { } } // ---- -// Warning: Experimental features are turned on. Do not use experimental features on live deployments. +// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments. diff --git a/test/libsolidity/syntaxTests/structs/recursion/parallel_structs.sol b/test/libsolidity/syntaxTests/structs/recursion/parallel_structs.sol index d4ad088d..96362ef0 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/parallel_structs.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/parallel_structs.sol @@ -12,4 +12,4 @@ contract TestContract function addTestStruct(TestStruct) public pure {} } // ---- -// Warning: Experimental features are turned on. Do not use experimental features on live deployments. +// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments. diff --git a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol index c02a8aa4..4966a731 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: Internal or recursive type is not allowed for public or external functions. +// TypeError: (91-92): Internal or recursive type is not allowed for public or external functions. diff --git a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol index e9488cf4..68113924 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs2.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: Internal or recursive type is not allowed for public or external functions. +// TypeError: (94-95): Internal or recursive type is not allowed for public or external functions. diff --git a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol index 6728baec..47690d9b 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/return_recursive_structs3.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// TypeError: Internal or recursive type is not allowed for public or external functions. +// TypeError: (119-122): Internal or recursive type is not allowed for public or external functions. diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive.sol index cac2e23f..bcffe383 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive.sol @@ -5,4 +5,4 @@ contract Test { } } // ---- -// TypeError: Recursive struct definition. +// TypeError: (20-93): Recursive struct definition. diff --git a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive.sol b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive.sol index 11fc6307..64dab8d0 100644 --- a/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive.sol +++ b/test/libsolidity/syntaxTests/structs/recursion/struct_definition_indirectly_recursive.sol @@ -9,4 +9,4 @@ contract Test { } } // ---- -// TypeError: Recursive struct definition. +// TypeError: (20-118): Recursive struct definition. diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_default.sol b/test/libsolidity/syntaxTests/visibility/interface/function_default.sol index 7b9044dd..72ce3b40 100644 --- a/test/libsolidity/syntaxTests/visibility/interface/function_default.sol +++ b/test/libsolidity/syntaxTests/visibility/interface/function_default.sol @@ -2,5 +2,5 @@ interface I { function f(); } // ---- -// Warning: Functions in interfaces should be declared external. -// Warning: No visibility specified. Defaulting to "public". In interfaces it defaults to external. +// Warning: (15-28): Functions in interfaces should be declared external. +// Warning: (15-28): No visibility specified. Defaulting to "public". In interfaces it defaults to external. diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_default050.sol b/test/libsolidity/syntaxTests/visibility/interface/function_default050.sol index 127d4e92..513df26b 100644 --- a/test/libsolidity/syntaxTests/visibility/interface/function_default050.sol +++ b/test/libsolidity/syntaxTests/visibility/interface/function_default050.sol @@ -3,5 +3,5 @@ interface I { function f(); } // ---- -// SyntaxError: No visibility specified. -// TypeError: Functions in interfaces must be declared external. +// SyntaxError: (45-58): No visibility specified. +// TypeError: (45-58): Functions in interfaces must be declared external. diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_internal.sol b/test/libsolidity/syntaxTests/visibility/interface/function_internal.sol index a1cf5246..ac62e69b 100644 --- a/test/libsolidity/syntaxTests/visibility/interface/function_internal.sol +++ b/test/libsolidity/syntaxTests/visibility/interface/function_internal.sol @@ -2,4 +2,4 @@ interface I { function f() internal; } // ---- -// TypeError: Functions in interfaces cannot be internal or private. +// TypeError: (15-37): Functions in interfaces cannot be internal or private. diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_private.sol b/test/libsolidity/syntaxTests/visibility/interface/function_private.sol index 887ebd4b..881e647e 100644 --- a/test/libsolidity/syntaxTests/visibility/interface/function_private.sol +++ b/test/libsolidity/syntaxTests/visibility/interface/function_private.sol @@ -2,4 +2,4 @@ interface I { function f() private; } // ---- -// TypeError: Functions in interfaces cannot be internal or private. +// TypeError: (15-36): Functions in interfaces cannot be internal or private. diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_public.sol b/test/libsolidity/syntaxTests/visibility/interface/function_public.sol index 146d4f5b..891d9fdf 100644 --- a/test/libsolidity/syntaxTests/visibility/interface/function_public.sol +++ b/test/libsolidity/syntaxTests/visibility/interface/function_public.sol @@ -2,4 +2,4 @@ interface I { function f() public; } // ---- -// Warning: Functions in interfaces should be declared external.
\ No newline at end of file +// Warning: (15-35): Functions in interfaces should be declared external. diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_public050.sol b/test/libsolidity/syntaxTests/visibility/interface/function_public050.sol index f957f0b4..e0c04095 100644 --- a/test/libsolidity/syntaxTests/visibility/interface/function_public050.sol +++ b/test/libsolidity/syntaxTests/visibility/interface/function_public050.sol @@ -3,4 +3,4 @@ interface I { function f() public; } // ---- -// TypeError: Functions in interfaces must be declared external.
\ No newline at end of file +// TypeError: (45-65): Functions in interfaces must be declared external. diff --git a/test/tools/isoltest.cpp b/test/tools/isoltest.cpp index 07df8f60..7a147bd0 100644 --- a/test/tools/isoltest.cpp +++ b/test/tools/isoltest.cpp @@ -55,7 +55,6 @@ public: { Success, Failure, - InputOutputError, Exception }; @@ -90,11 +89,53 @@ string SyntaxTestTool::editor; void SyntaxTestTool::printContract() const { - stringstream stream(m_test->source()); - string line; - while (getline(stream, line)) - cout << " " << line << endl; - cout << endl; + if (m_formatted) + { + string const& source = m_test->source(); + if (source.empty()) + return; + + std::vector<char const*> sourceFormatting(source.length(), formatting::RESET); + for (auto const& error: m_test->errorList()) + if (error.locationStart >= 0 && error.locationEnd >= 0) + { + assert(static_cast<size_t>(error.locationStart) < source.length()); + assert(static_cast<size_t>(error.locationEnd) < source.length()); + bool isWarning = error.type == "Warning"; + for (int i = error.locationStart; i < error.locationEnd; i++) + if (isWarning) + { + if (sourceFormatting[i] == formatting::RESET) + sourceFormatting[i] = formatting::ORANGE_BACKGROUND; + } + else + sourceFormatting[i] = formatting::RED_BACKGROUND; + } + + cout << " " << sourceFormatting.front() << source.front(); + for (size_t i = 1; i < source.length(); i++) + { + if (sourceFormatting[i] != sourceFormatting[i - 1]) + cout << sourceFormatting[i]; + if (source[i] != '\n') + cout << source[i]; + else + { + cout << formatting::RESET << endl; + if (i + 1 < source.length()) + cout << " " << sourceFormatting[i]; + } + } + cout << formatting::RESET << endl; + } + else + { + stringstream stream(m_test->source()); + string line; + while (getline(stream, line)) + cout << " " << line << endl; + cout << endl; + } } SyntaxTestTool::Result SyntaxTestTool::process() @@ -107,15 +148,6 @@ SyntaxTestTool::Result SyntaxTestTool::process() try { m_test = unique_ptr<SyntaxTest>(new SyntaxTest(m_path.string())); - } - catch (std::exception const& _e) - { - FormattedScope(cout, m_formatted, {BOLD, RED}) << "cannot read test: " << _e.what() << endl; - return Result::InputOutputError; - } - - try - { success = m_test->run(outputMessages, " ", m_formatted); } catch(CompilerError const& _e) @@ -142,6 +174,11 @@ SyntaxTestTool::Result SyntaxTestTool::process() "UnimplementedFeatureError: " << SyntaxTest::errorMessage(_e) << endl; return Result::Exception; } + catch (std::exception const& _e) + { + FormattedScope(cout, m_formatted, {BOLD, RED}) << "Exception: " << _e.what() << endl; + return Result::Exception; + } catch(...) { FormattedScope(cout, m_formatted, {BOLD, RED}) << @@ -262,10 +299,6 @@ SyntaxTestStats SyntaxTestTool::processPath( paths.pop(); ++successCount; break; - default: - // non-recoverable error; continue with next test case - paths.pop(); - break; } } } |