aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--SolidityNameAndTypeResolution.cpp36
-rw-r--r--SolidityTypes.cpp1
2 files changed, 34 insertions, 3 deletions
diff --git a/SolidityNameAndTypeResolution.cpp b/SolidityNameAndTypeResolution.cpp
index 591cf053..4e816696 100644
--- a/SolidityNameAndTypeResolution.cpp
+++ b/SolidityNameAndTypeResolution.cpp
@@ -359,7 +359,7 @@ BOOST_AUTO_TEST_CASE(function_canonical_signature)
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
{
auto functions = contract->getDefinedFunctions();
- BOOST_CHECK_EQUAL("foo(uint256,uint64,bool)", functions[0]->getCanonicalSignature());
+ BOOST_CHECK_EQUAL("foo(uint256,uint64,bool)", functions[0]->externalTypes());
}
}
@@ -376,10 +376,41 @@ BOOST_AUTO_TEST_CASE(function_canonical_signature_type_aliases)
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
{
auto functions = contract->getDefinedFunctions();
- BOOST_CHECK_EQUAL("boo(uint256,bytes32,address)", functions[0]->getCanonicalSignature());
+ BOOST_CHECK_EQUAL("boo(uint256,bytes32,address)", functions[0]->externalTypes());
}
}
+BOOST_AUTO_TEST_CASE(function_external_types)
+{
+ ASTPointer<SourceUnit> sourceUnit;
+ char const* text = R"(
+ contract Test {
+ function boo(uint arg2, bool arg3, bytes8 arg4) returns (uint ret) {
+ ret = 5;
+ }
+ })";
+ ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseTextAndResolveNames(text), "Parsing and name Resolving failed");
+ for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes())
+ if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
+ {
+ auto functions = contract->getDefinedFunctions();
+ BOOST_CHECK_EQUAL("boo(uint256,bool,bytes8)", functions[0]->externalTypes());
+ }
+}
+
+//todo should check arrays and contract. also event
+//BOOST_AUTO_TEST_CASE(function_external_types_throw)
+//{
+// ASTPointer<SourceUnit> sourceUnit;
+// char const* text = R"(
+// contract Test {
+// function boo(uint32[] arg5) returns (uint ret) {
+// ret = 5;
+// }
+// })";
+// BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
+//}
+
BOOST_AUTO_TEST_CASE(hash_collision_in_interface)
{
char const* text = "contract test {\n"
@@ -635,7 +666,6 @@ BOOST_AUTO_TEST_CASE(state_variable_accessors)
"mapping(uint=>bytes4) public map;\n"
"mapping(uint=>mapping(uint=>bytes4)) public multiple_map;\n"
"}\n";
-
ASTPointer<SourceUnit> source;
ContractDefinition const* contract;
ETH_TEST_CHECK_NO_THROW(source = parseTextAndResolveNames(text), "Parsing and Resolving names failed");
diff --git a/SolidityTypes.cpp b/SolidityTypes.cpp
index 6b630647..4133ce7b 100644
--- a/SolidityTypes.cpp
+++ b/SolidityTypes.cpp
@@ -86,6 +86,7 @@ BOOST_AUTO_TEST_CASE(storage_layout_arrays)
BOOST_CHECK(ArrayType(ArrayType::Location::Storage, make_shared<FixedBytesType>(32), 9).getStorageSize() == 9);
}
+
BOOST_AUTO_TEST_SUITE_END()
}