mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adding mapping treatment to FunctionType
Plus a TypeResolution test for it
This commit is contained in:
parent
69fa5db471
commit
c742c09ae6
@ -637,6 +637,7 @@ BOOST_AUTO_TEST_CASE(state_variable_accessors)
|
|||||||
" uint64(2);\n"
|
" uint64(2);\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"uint256 foo;\n"
|
"uint256 foo;\n"
|
||||||
|
"mapping(uint=>string4) map;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
ASTPointer<SourceUnit> source;
|
ASTPointer<SourceUnit> source;
|
||||||
@ -644,10 +645,17 @@ BOOST_AUTO_TEST_CASE(state_variable_accessors)
|
|||||||
BOOST_CHECK_NO_THROW(source = parseTextAndResolveNamesWithChecks(text));
|
BOOST_CHECK_NO_THROW(source = parseTextAndResolveNamesWithChecks(text));
|
||||||
BOOST_REQUIRE((contract = retrieveContract(source, 0)) != nullptr);
|
BOOST_REQUIRE((contract = retrieveContract(source, 0)) != nullptr);
|
||||||
FunctionTypePointer function = retrieveFunctionBySignature(contract, "foo()");
|
FunctionTypePointer function = retrieveFunctionBySignature(contract, "foo()");
|
||||||
BOOST_REQUIRE(function->hasDeclaration());
|
BOOST_REQUIRE(function && function->hasDeclaration());
|
||||||
auto returnParams = function->getReturnParameterTypeNames();
|
auto returnParams = function->getReturnParameterTypeNames();
|
||||||
BOOST_CHECK_EQUAL(returnParams.at(0), "uint256");
|
BOOST_CHECK_EQUAL(returnParams.at(0), "uint256");
|
||||||
BOOST_CHECK(function->isConstant());
|
BOOST_CHECK(function->isConstant());
|
||||||
|
function = retrieveFunctionBySignature(contract, "map(uint256)");
|
||||||
|
BOOST_REQUIRE(function && function->hasDeclaration());
|
||||||
|
auto Params = function->getParameterTypeNames();
|
||||||
|
BOOST_CHECK_EQUAL(returnParams.at(0), "uint256");
|
||||||
|
returnParams = function->getReturnParameterTypeNames();
|
||||||
|
BOOST_CHECK_EQUAL(returnParams.at(0), "string4");
|
||||||
|
BOOST_CHECK(function->isConstant());
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(function_clash_with_state_variable_accessor)
|
BOOST_AUTO_TEST_CASE(function_clash_with_state_variable_accessor)
|
||||||
|
Loading…
Reference in New Issue
Block a user