From 1536e49b3d0b769d98374d7eed2559ccde857600 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 4 Nov 2020 23:18:44 +0000 Subject: [PATCH] Add more syntax tests for uncovered cases --- scripts/error_codes.py | 18 +++++++++--------- .../calloptions_on_staticcall.sol | 10 ++++++++++ .../functionCalls/staticcall_on_homestead.sol | 10 ++++++++++ .../inheritance/base_not_contract.sol | 5 +++++ .../assignment_from_functiontype3.sol | 11 +++++++++++ .../assignment_from_opcode_like.sol | 10 ++++++++++ .../assignment_to_opcode_like.sol | 10 ++++++++++ .../inlineAssembly/evm_constantinople.sol | 5 +++++ .../evm_constantinople_on_byzantium.sol | 7 +++++++ .../shadowing/variable_by_opcode.sol | 14 ++++++++++++++ .../syntaxTests/tryCatch/creation.sol | 13 +++++++++++++ .../syntaxTests/tryCatch/no_special.sol | 18 ++++++++++++++++++ .../yulSyntaxTests/assignment_of_function.yul | 6 ++++++ .../yulSyntaxTests/builtin_identifier_6.yul | 6 ++++++ .../yulSyntaxTests/builtin_identifier_7.yul | 7 +++++++ test/libyul/yulSyntaxTests/call_literal.yul | 5 +++++ .../yulSyntaxTests/literal_invalid_type.yul | 7 +++++++ 17 files changed, 153 insertions(+), 9 deletions(-) create mode 100644 test/libsolidity/syntaxTests/functionCalls/calloptions_on_staticcall.sol create mode 100644 test/libsolidity/syntaxTests/functionCalls/staticcall_on_homestead.sol create mode 100644 test/libsolidity/syntaxTests/inheritance/base_not_contract.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/assignment_from_functiontype3.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/assignment_from_opcode_like.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/assignment_to_opcode_like.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/shadowing/variable_by_opcode.sol create mode 100644 test/libsolidity/syntaxTests/tryCatch/creation.sol create mode 100644 test/libsolidity/syntaxTests/tryCatch/no_special.sol create mode 100644 test/libyul/yulSyntaxTests/assignment_of_function.yul create mode 100644 test/libyul/yulSyntaxTests/builtin_identifier_6.yul create mode 100644 test/libyul/yulSyntaxTests/builtin_identifier_7.yul create mode 100644 test/libyul/yulSyntaxTests/call_literal.yul create mode 100644 test/libyul/yulSyntaxTests/literal_invalid_type.yul diff --git a/scripts/error_codes.py b/scripts/error_codes.py index 9ecfd0dca..f84c8da93 100755 --- a/scripts/error_codes.py +++ b/scripts/error_codes.py @@ -220,15 +220,15 @@ def examine_id_coverage(top_dir, source_id_to_file_names, new_ids_only=False): return False old_source_only_ids = { - "1123", "1218", "1220", "1584", "1823", "1950", - "1988", "2461", "2512", "2592", "2657", "2800", "2842", "2856", - "3046", "3263", "3356", "3441", "3682", "3876", - "3893", "3996", "4010", "4281", "4802", - "5052", "5073", "5170", "5188", "5272", "5347", "5473", - "5622", "6041", "6084", "6272", "7110", "7128", "7186", - "7589", "7593", "7653", "7812", "7885", "8065", "8084", "8140", - "8261", "8312", "8592", "8758", "9011", - "9085", "9390", "9440", "9547", "9551", "9615", "9980", + "1123", "1220", "1584", "1823", "1950", + "1988", "2512", "2657", "2800", + "3046", "3263", "3356", "3682", "3876", + "3893", "3996", "4010", "4802", + "5073", "5188", "5272", + "5622", "6084", "6272", "7128", "7186", + "7589", "7593", "7653", "7885", "8065", "8084", "8140", + "8312", "8592", "9011", + "9085", "9390", "9551", } new_source_only_ids = source_only_ids - old_source_only_ids diff --git a/test/libsolidity/syntaxTests/functionCalls/calloptions_on_staticcall.sol b/test/libsolidity/syntaxTests/functionCalls/calloptions_on_staticcall.sol new file mode 100644 index 000000000..e128f03f1 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionCalls/calloptions_on_staticcall.sol @@ -0,0 +1,10 @@ +contract C { + function foo() pure internal { + address(10).staticcall{value: 7, gas: 3}(""); + } +} +// ==== +// EVMVersion: >=byzantium +// ---- +// TypeError 2842: (56-96): Cannot set option "value" for staticcall. +// Warning 9302: (56-100): Return value of low-level calls not used. diff --git a/test/libsolidity/syntaxTests/functionCalls/staticcall_on_homestead.sol b/test/libsolidity/syntaxTests/functionCalls/staticcall_on_homestead.sol new file mode 100644 index 000000000..dc5797c91 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionCalls/staticcall_on_homestead.sol @@ -0,0 +1,10 @@ +contract C { + function f() public { + (bool success, ) = address(10).staticcall{gas: 3}(""); + success; + } +} +// ==== +// EVMVersion: