From c032ad33795d923f8eddc5b4e2c50bc0e13a162c Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 29 Jul 2020 19:13:44 +0100 Subject: [PATCH] Update tests --- test/libsolidity/InlineAssembly.cpp | 6 ------ .../inlineAssembly/linkersymbol_function.sol | 1 + .../inlineAssembly/reserved_identifiers.sol | 13 +++++++++++++ .../reserved_identifiers_byzantium.sol | 16 ++++++++++++++++ .../reserved_identifiers_constantinople.sol | 14 ++++++++++++++ ...tems_on_tack.yul => leave_items_on_stack.yul} | 0 .../yulSyntaxTests/linkersymbol_evmtyped.yul | 2 ++ test/libyul/yulSyntaxTests/objects/datacopy.yul | 1 + 8 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/reserved_identifiers.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/reserved_identifiers_byzantium.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/reserved_identifiers_constantinople.sol rename test/libyul/yulSyntaxTests/invalid/{leave_items_on_tack.yul => leave_items_on_stack.yul} (100%) diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp index d6f7becf0..af7bbd831 100644 --- a/test/libsolidity/InlineAssembly.cpp +++ b/test/libsolidity/InlineAssembly.cpp @@ -359,12 +359,6 @@ BOOST_AUTO_TEST_CASE(shift_constantinople_warning) CHECK_PARSE_WARNING("{ sar(10, 32) }", TypeError, "The \"sar\" instruction is only available for Constantinople-compatible VMs"); } -BOOST_AUTO_TEST_CASE(jump_error) -{ - CHECK_PARSE_WARNING("{ jump(44) }", DeclarationError, "Function not found."); - CHECK_PARSE_WARNING("{ jumpi(44, 2) }", DeclarationError, "Function not found."); -} - BOOST_AUTO_TEST_SUITE_END() // }}} BOOST_AUTO_TEST_SUITE_END() diff --git a/test/libsolidity/syntaxTests/inlineAssembly/linkersymbol_function.sol b/test/libsolidity/syntaxTests/inlineAssembly/linkersymbol_function.sol index 9d1d6c4f3..7434ddfd5 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/linkersymbol_function.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/linkersymbol_function.sol @@ -8,3 +8,4 @@ contract C { } } // ---- +// DeclarationError 5017: (63-90): The identifier "linkersymbol" is reserved and can not be used. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/reserved_identifiers.sol b/test/libsolidity/syntaxTests/inlineAssembly/reserved_identifiers.sol new file mode 100644 index 000000000..6660887d0 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/reserved_identifiers.sol @@ -0,0 +1,13 @@ +contract C { + function f() public pure { + assembly { + let linkersymbol := 1 + let datacopy := 1 + let swap16 := 1 + } + } +} +// ---- +// DeclarationError 5017: (67-79): The identifier "linkersymbol" is reserved and can not be used. +// DeclarationError 5017: (95-103): The identifier "datacopy" is reserved and can not be used. +// DeclarationError 5017: (119-125): The identifier "swap16" is reserved and can not be used. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/reserved_identifiers_byzantium.sol b/test/libsolidity/syntaxTests/inlineAssembly/reserved_identifiers_byzantium.sol new file mode 100644 index 000000000..b6cdf4540 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/reserved_identifiers_byzantium.sol @@ -0,0 +1,16 @@ +contract C { + function f() public pure { + assembly { + let shl := 1 + } + assembly { + pop(shl(1, 2)) + } + } +} +// ==== +// EVMVersion: =byzantium +// ---- +// DeclarationError 5017: (67-70): The identifier "shl" is reserved and can not be used. +// TypeError 6612: (107-110): The "shl" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium"). +// TypeError 3950: (107-116): Expected expression to evaluate to one value, but got 0 values instead. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/reserved_identifiers_constantinople.sol b/test/libsolidity/syntaxTests/inlineAssembly/reserved_identifiers_constantinople.sol new file mode 100644 index 000000000..cea698fd1 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/reserved_identifiers_constantinople.sol @@ -0,0 +1,14 @@ +contract C { + function f() public pure { + assembly { + let shl := 1 + } + assembly { + pop(shl(1, 2)) + } + } +} +// ==== +// EVMVersion: >=constantinople +// ---- +// ParserError 5568: (67-70): Cannot use builtin function name "shl" as identifier name. diff --git a/test/libyul/yulSyntaxTests/invalid/leave_items_on_tack.yul b/test/libyul/yulSyntaxTests/invalid/leave_items_on_stack.yul similarity index 100% rename from test/libyul/yulSyntaxTests/invalid/leave_items_on_tack.yul rename to test/libyul/yulSyntaxTests/invalid/leave_items_on_stack.yul diff --git a/test/libyul/yulSyntaxTests/linkersymbol_evmtyped.yul b/test/libyul/yulSyntaxTests/linkersymbol_evmtyped.yul index 1cadcee0c..aa9cc3adb 100644 --- a/test/libyul/yulSyntaxTests/linkersymbol_evmtyped.yul +++ b/test/libyul/yulSyntaxTests/linkersymbol_evmtyped.yul @@ -1,6 +1,8 @@ { let addr:u256 := linkersymbol("contract/library.sol:L") + function linkersymbol(x) {} } // ==== // dialect: evmTyped // ---- +// ParserError 5568: (75-87): Cannot use builtin function name "linkersymbol" as identifier name. diff --git a/test/libyul/yulSyntaxTests/objects/datacopy.yul b/test/libyul/yulSyntaxTests/objects/datacopy.yul index bc7e211d8..6e36025fc 100644 --- a/test/libyul/yulSyntaxTests/objects/datacopy.yul +++ b/test/libyul/yulSyntaxTests/objects/datacopy.yul @@ -6,3 +6,4 @@ let s := "" datacopy(x, "11", s) } +// ----