aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/SolidityParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity/SolidityParser.cpp')
-rw-r--r--libsolidity/SolidityParser.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/libsolidity/SolidityParser.cpp b/libsolidity/SolidityParser.cpp
index ad17c40a..cad0e1f2 100644
--- a/libsolidity/SolidityParser.cpp
+++ b/libsolidity/SolidityParser.cpp
@@ -134,6 +134,31 @@ BOOST_AUTO_TEST_CASE(missing_argument_in_named_args)
BOOST_CHECK_THROW(parseText(text), ParserError);
}
+BOOST_AUTO_TEST_CASE(two_exact_functions)
+{
+ char const* text = R"(
+ contract test {
+ function fun(uint a) returns(uint r) { return a; }
+ function fun(uint a) returns(uint r) { return a; }
+ }
+ )";
+ // with support of overloaded functions, during parsing,
+ // we can't determine whether they match exactly, however
+ // it will throw DeclarationError in following stage.
+ BOOST_CHECK_NO_THROW(parseText(text));
+}
+
+BOOST_AUTO_TEST_CASE(overloaded_functions)
+{
+ char const* text = R"(
+ contract test {
+ function fun(uint a) returns(uint r) { return a; }
+ function fun(uint a, uint b) returns(uint r) { return a + b; }
+ }
+ )";
+ BOOST_CHECK_NO_THROW(parseText(text));
+}
+
BOOST_AUTO_TEST_CASE(function_natspec_documentation)
{
ASTPointer<ContractDefinition> contract;