diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 15 | ||||
-rw-r--r-- | test/libsolidity/syntaxTests/nameAndTypeResolution/469_create2_as_variable.sol | 6 |
2 files changed, 15 insertions, 6 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 98d58fe5..e1516f84 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -402,6 +402,21 @@ BOOST_AUTO_TEST_CASE(returndatasize_as_variable) CHECK_ALLOW_MULTI(text, expectations); } +BOOST_AUTO_TEST_CASE(create2_as_variable) +{ + char const* text = R"( + contract c { function f() public { uint create2; assembly { create2(0, 0, 0, 0) } }} + )"; + // This needs special treatment, because the message mentions the EVM version, + // so cannot be run via isoltest. + CHECK_ALLOW_MULTI(text, (std::vector<std::pair<Error::Type, std::string>>{ + {Error::Type::Warning, "Variable is shadowed in inline assembly by an instruction of the same name"}, + {Error::Type::Warning, "The \"create2\" instruction is not supported by the VM version"}, + {Error::Type::DeclarationError, "Unbalanced stack"}, + {Error::Type::Warning, "not supposed to return values"} + })); +} + BOOST_AUTO_TEST_CASE(getter_is_memory_type) { char const* text = R"( diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/469_create2_as_variable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/469_create2_as_variable.sol deleted file mode 100644 index 70db84a3..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/469_create2_as_variable.sol +++ /dev/null @@ -1,6 +0,0 @@ -contract c { function f() public { uint create2; assembly { create2(0, 0, 0, 0) } }} -// ---- -// Warning: (35-47): Variable is shadowed in inline assembly by an instruction of the same name -// Warning: (60-79): The "create2" instruction is not supported by the VM version "byzantium" you are currently compiling for. It will be interpreted as an invalid instruction on this VM. -// Warning: (60-79): Top-level expressions are not supposed to return values (this expression returns 1 value). Use ``pop()`` or assign them. -// DeclarationError: (58-81): Unbalanced stack at the end of a block: 1 surplus item(s). |