mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6030 from ethereum/fixABIEncoderV2Mapping
Allow cleanup for mappings (do nothing).
This commit is contained in:
commit
55c4131a03
@ -8,6 +8,7 @@ Compiler Features:
|
||||
|
||||
|
||||
Bugfixes:
|
||||
* ABIEncoderV2: Fix internal error related to mappings as library parameters.
|
||||
* Yul: Properly detect name clashes with functions before their declaration.
|
||||
|
||||
|
||||
|
@ -308,6 +308,7 @@ string ABIFunctions::cleanupFunction(Type const& _type, bool _revertOnFailure)
|
||||
break;
|
||||
case Type::Category::Array:
|
||||
case Type::Category::Struct:
|
||||
case Type::Category::Mapping:
|
||||
solAssert(_type.dataStoredIn(DataLocation::Storage), "Cleanup requested for non-storage reference type.");
|
||||
templ("body", "cleaned := value");
|
||||
break;
|
||||
|
@ -9037,9 +9037,13 @@ BOOST_AUTO_TEST_CASE(using_library_mappings_external)
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(libSourceCode, 0, "Lib");
|
||||
compileAndRun(sourceCode, 0, "Test", bytes(), map<string, Address>{{"Lib", m_contractAddress}});
|
||||
ABI_CHECK(callContractFunction("f()"), encodeArgs(u256(2), u256(0), u256(84), u256(46), u256(0), u256(198)));
|
||||
for (auto v2: {false, true})
|
||||
{
|
||||
string prefix = v2 ? "pragma experimental ABIEncoderV2;\n" : "";
|
||||
compileAndRun(prefix + libSourceCode, 0, "Lib");
|
||||
compileAndRun(prefix + sourceCode, 0, "Test", bytes(), map<string, Address>{{"Lib", m_contractAddress}});
|
||||
ABI_CHECK(callContractFunction("f()"), encodeArgs(u256(2), u256(0), u256(84), u256(46), u256(0), u256(198)));
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(using_library_mappings_return)
|
||||
|
Loading…
Reference in New Issue
Block a user