diff --git a/scripts/error_codes.py b/scripts/error_codes.py index d77fcacaa..8fe1b6a28 100755 --- a/scripts/error_codes.py +++ b/scripts/error_codes.py @@ -226,7 +226,7 @@ def examine_id_coverage(top_dir, source_id_to_file_names, new_ids_only=False): "3893", "3997", "4010", "4802", "4805", "4828", "4904", "4990", "5052", "5073", "5170", "5188", "5272", "5333", "5347", "5473", "5622", "6041", "6052", "6272", "6708", "6792", "6931", "7110", "7128", "7186", - "7319", "7589", "7593", "7653", "7812", "7885", "8065", "8084", "8140", + "7589", "7593", "7653", "7812", "7885", "8065", "8084", "8140", "8261", "8312", "8592", "8758", "9011", "9085", "9390", "9440", "9547", "9551", "9615", "9980" } diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index 53c93c726..41fe4b53b 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -599,42 +599,6 @@ BOOST_AUTO_TEST_CASE(complex_import) BOOST_CHECK(successParse(text)); } -BOOST_AUTO_TEST_CASE(recursion_depth1) -{ - string text("contract C { bytes"); - for (size_t i = 0; i < 30000; i++) - text += "["; - CHECK_PARSE_ERROR(text.c_str(), "Maximum recursion depth reached during parsing"); -} - -BOOST_AUTO_TEST_CASE(recursion_depth2) -{ - string text("contract C { function f() {"); - for (size_t i = 0; i < 30000; i++) - text += "{"; - CHECK_PARSE_ERROR(text, "Maximum recursion depth reached during parsing"); -} - -BOOST_AUTO_TEST_CASE(recursion_depth3) -{ - string text("contract C { function f() { uint x = f("); - for (size_t i = 0; i < 30000; i++) - text += "("; - CHECK_PARSE_ERROR(text, "Maximum recursion depth reached during parsing"); -} - -BOOST_AUTO_TEST_CASE(recursion_depth4) -{ - string text("contract C { function f() { uint a;"); - for (size_t i = 0; i < 30000; i++) - text += "("; - text += "a"; - for (size_t i = 0; i < 30000; i++) - text += "++)"; - text += "}}"; - CHECK_PARSE_ERROR(text, "Maximum recursion depth reached during parsing"); -} - BOOST_AUTO_TEST_CASE(inline_asm_end_location) { auto sourceCode = std::string(R"( diff --git a/test/libsolidity/syntaxTests/parsing/max_depth_reached_1.sol b/test/libsolidity/syntaxTests/parsing/max_depth_reached_1.sol new file mode 100644 index 000000000..b193b3c42 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/max_depth_reached_1.sol @@ -0,0 +1,8 @@ +contract C { + bytes + [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ // 100*[ + [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ + [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [ +.... +// ---- +// ParserError 7319: (287-288): Maximum recursion depth reached during parsing. diff --git a/test/libsolidity/syntaxTests/parsing/max_depth_reached_2.sol b/test/libsolidity/syntaxTests/parsing/max_depth_reached_2.sol new file mode 100644 index 000000000..d57f24055 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/max_depth_reached_2.sol @@ -0,0 +1,11 @@ +contract C { + function f() { + {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{ // 100*{ + {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{ + {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{ + {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{ + {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{ + {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{ { +.... +// ---- +// ParserError 7319: (693-694): Maximum recursion depth reached during parsing. diff --git a/test/libsolidity/syntaxTests/parsing/max_depth_reached_3.sol b/test/libsolidity/syntaxTests/parsing/max_depth_reached_3.sol new file mode 100644 index 000000000..d5dfa4af5 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/max_depth_reached_3.sol @@ -0,0 +1,9 @@ +contract C { + function f() { + uint x = f + (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( // 100*( + (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( + (((((((((((((((((((((((((((((((((((((( ( +.... +// ---- +// ParserError 7319: (325-326): Maximum recursion depth reached during parsing. diff --git a/test/libsolidity/syntaxTests/parsing/max_depth_reached_4.sol b/test/libsolidity/syntaxTests/parsing/max_depth_reached_4.sol new file mode 100644 index 000000000..07a356f77 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/max_depth_reached_4.sol @@ -0,0 +1,31 @@ +contract C { + function f() public pure { + uint ok = 0; + uint nok = 0; + + (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( + ( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( ( + (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( + ( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( ( + (-( (-( (-( (-( (-( (-( (-( (-( ( + ok++ + ))))))))))))))))) + )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) + )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); + + ( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( ( + (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( + ( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( ( + (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( (-( + ( (-( (-( (-( (-( (-( (-( (-( (-( ( + nok++ + )))))))))))))))))) + )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) + )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); + + ? // enforce compilation error, otherwise chk_antlr_grammar complains that + // a grammatically correct file does not compile + } +} +// ---- +// ParserError 7319: (1305-1308): Maximum recursion depth reached during parsing.