From 910ea59ace5aa678bca3f3fb662e9dd940f3f0e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 27 Oct 2021 19:46:07 +0200 Subject: [PATCH] Update expectation in tests for inline assembly with name clashes --- .../inline_assembly_function_name_clash/args | 1 - .../inline_assembly_function_name_clash/err | 5 - .../input.sol | 18 -- .../output | 168 ------------------ .../inlineAssembly/function_name_clash.sol | 13 -- .../inlineAssembly/function_name_clash.sol | 11 ++ .../function_name_clash_via_modifier.sol | 24 +++ 7 files changed, 35 insertions(+), 205 deletions(-) delete mode 100644 test/cmdlineTests/inline_assembly_function_name_clash/args delete mode 100644 test/cmdlineTests/inline_assembly_function_name_clash/err delete mode 100644 test/cmdlineTests/inline_assembly_function_name_clash/input.sol delete mode 100644 test/cmdlineTests/inline_assembly_function_name_clash/output delete mode 100644 test/libsolidity/semanticTests/inlineAssembly/function_name_clash.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/function_name_clash.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/function_name_clash_via_modifier.sol diff --git a/test/cmdlineTests/inline_assembly_function_name_clash/args b/test/cmdlineTests/inline_assembly_function_name_clash/args deleted file mode 100644 index 4299d023e..000000000 --- a/test/cmdlineTests/inline_assembly_function_name_clash/args +++ /dev/null @@ -1 +0,0 @@ ---experimental-via-ir --combined-json function-debug-runtime --pretty-json --json-indent 4 \ No newline at end of file diff --git a/test/cmdlineTests/inline_assembly_function_name_clash/err b/test/cmdlineTests/inline_assembly_function_name_clash/err deleted file mode 100644 index 5284ffe5c..000000000 --- a/test/cmdlineTests/inline_assembly_function_name_clash/err +++ /dev/null @@ -1,5 +0,0 @@ -Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information. ---> inline_assembly_function_name_clash/input.sol - -Warning: Source file does not specify required compiler version! ---> inline_assembly_function_name_clash/input.sol diff --git a/test/cmdlineTests/inline_assembly_function_name_clash/input.sol b/test/cmdlineTests/inline_assembly_function_name_clash/input.sol deleted file mode 100644 index 55032c56e..000000000 --- a/test/cmdlineTests/inline_assembly_function_name_clash/input.sol +++ /dev/null @@ -1,18 +0,0 @@ -contract C { - uint x; - modifier m() { - uint t; - assembly { - function f() -> x { x := 8 } - t := f() - } - x = t; - _; - } - function f() m m public returns (uint r) { - assembly { function f() -> x { x := 1 } r := f() } - } - function g() m m public returns (uint r) { - assembly { function f() -> x { x := 2 } r := f() } - } -} \ No newline at end of file diff --git a/test/cmdlineTests/inline_assembly_function_name_clash/output b/test/cmdlineTests/inline_assembly_function_name_clash/output deleted file mode 100644 index 00192f8f4..000000000 --- a/test/cmdlineTests/inline_assembly_function_name_clash/output +++ /dev/null @@ -1,168 +0,0 @@ -{ - "contracts": - { - "inline_assembly_function_name_clash/input.sol:C": - { - "function-debug-runtime": - { - "abi_decode_tuple_": - { - "entryPoint": 216, - "parameterSlots": 2, - "returnSlots": 0 - }, - "abi_encode_t_uint256_to_t_uint256_fromStack": - { - "entryPoint": 250, - "parameterSlots": 2, - "returnSlots": 0 - }, - "abi_encode_tuple_t_uint256__to_t_uint256__fromStack": - { - "entryPoint": 265, - "parameterSlots": 2, - "returnSlots": 1 - }, - "allocate_unbounded": - { - "entryPoint": 196, - "parameterSlots": 0, - "returnSlots": 1 - }, - "cleanup_t_uint256": - { - "entryPoint": 240, - "parameterSlots": 1, - "returnSlots": 1 - }, - "convert_t_uint256_to_t_uint256": - { - "entryPoint": 391, - "parameterSlots": 1, - "returnSlots": 1 - }, - "fun_f_25": - { - "entryPoint": 658, - "id": 25, - "parameterSlots": 0, - "returnSlots": 1 - }, - "fun_f_25_inner": - { - "entryPoint": 624, - "parameterSlots": 1, - "returnSlots": 1 - }, - "fun_g_36": - { - "entryPoint": 874, - "id": 36, - "parameterSlots": 0, - "returnSlots": 1 - }, - "fun_g_36_inner": - { - "entryPoint": 840, - "parameterSlots": 1, - "returnSlots": 1 - }, - "identity": - { - "entryPoint": 381, - "parameterSlots": 1, - "returnSlots": 1 - }, - "modifier_m_17": - { - "entryPoint": 470, - "id": 14, - "parameterSlots": 1, - "returnSlots": 1 - }, - "modifier_m_19": - { - "entryPoint": 547, - "id": 14, - "parameterSlots": 1, - "returnSlots": 1 - }, - "modifier_m_28": - { - "entryPoint": 686, - "id": 14, - "parameterSlots": 1, - "returnSlots": 1 - }, - "modifier_m_30": - { - "entryPoint": 763, - "id": 14, - "parameterSlots": 1, - "returnSlots": 1 - }, - "prepare_store_t_uint256": - { - "entryPoint": 425, - "parameterSlots": 1, - "returnSlots": 1 - }, - "revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74": - { - "entryPoint": 292, - "parameterSlots": 0, - "returnSlots": 0 - }, - "revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb": - { - "entryPoint": 206, - "parameterSlots": 0, - "returnSlots": 0 - }, - "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b": - { - "entryPoint": 211, - "parameterSlots": 0, - "returnSlots": 0 - }, - "shift_left_0": - { - "entryPoint": 302, - "parameterSlots": 1, - "returnSlots": 1 - }, - "shift_right_224_unsigned": - { - "entryPoint": 183, - "parameterSlots": 1, - "returnSlots": 1 - }, - "update_byte_slice_32_shift_0": - { - "entryPoint": 315, - "parameterSlots": 2, - "returnSlots": 1 - }, - "update_storage_value_offset_0t_uint256_to_t_uint256": - { - "entryPoint": 435, - "parameterSlots": 2, - "returnSlots": 0 - }, - "usr$f": - { - "entryPoint": 493, - "parameterSlots": 0, - "returnSlots": 1 - }, - "zero_value_for_split_t_uint256": - { - "entryPoint": 297, - "parameterSlots": 0, - "returnSlots": 1 - } - } - } - }, - "version": "" -} diff --git a/test/libsolidity/semanticTests/inlineAssembly/function_name_clash.sol b/test/libsolidity/semanticTests/inlineAssembly/function_name_clash.sol deleted file mode 100644 index 21fbdb28a..000000000 --- a/test/libsolidity/semanticTests/inlineAssembly/function_name_clash.sol +++ /dev/null @@ -1,13 +0,0 @@ -contract C { - function f() public pure returns (uint r) { - assembly { function f() -> x { x := 1 } r := f() } - } - function g() public pure returns (uint r) { - assembly { function f() -> x { x := 2 } r := f() } - } -} -// ==== -// compileViaYul: also -// ---- -// f() -> 1 -// g() -> 2 diff --git a/test/libsolidity/syntaxTests/inlineAssembly/function_name_clash.sol b/test/libsolidity/syntaxTests/inlineAssembly/function_name_clash.sol new file mode 100644 index 000000000..d43283dc8 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/function_name_clash.sol @@ -0,0 +1,11 @@ +contract C { + function f() public pure returns (uint r) { + assembly { function f() -> x { x := 1 } r := f() } + } + function g() public pure returns (uint r) { + assembly { function f() -> x { x := 2 } r := f() } + } +} +// ---- +// DeclarationError 3859: (80-108): This declaration shadows a declaration outside the inline assembly block. +// DeclarationError 3859: (193-221): This declaration shadows a declaration outside the inline assembly block. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/function_name_clash_via_modifier.sol b/test/libsolidity/syntaxTests/inlineAssembly/function_name_clash_via_modifier.sol new file mode 100644 index 000000000..f20a94c29 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/function_name_clash_via_modifier.sol @@ -0,0 +1,24 @@ +contract C { + uint y; + + modifier m() { + uint t; + assembly { + function f() -> x { x := 8 } + t := f() + } + y = t; + _; + } + + function f() m m public returns (uint r) { + assembly { function f() -> x { x := 1 } r := f() } + } + function g() m m public returns (uint r) { + assembly { function f() -> x { x := 2 } r := f() } + } +} +// ---- +// DeclarationError 3859: (92-120): This declaration shadows a declaration outside the inline assembly block. +// DeclarationError 3859: (251-279): This declaration shadows a declaration outside the inline assembly block. +// DeclarationError 3859: (363-391): This declaration shadows a declaration outside the inline assembly block.