Merge pull request #6030 from ethereum/fixABIEncoderV2Mapping

Allow cleanup for mappings (do nothing).
This commit is contained in:
chriseth
2019-02-19 13:56:21 +01:00
committed by GitHub
3 changed files with 9 additions and 3 deletions
+1
View File
@@ -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.
+1
View File
@@ -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;
+7 -3
View File
@@ -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)