diff options
author | chriseth <c@ethdev.com> | 2015-06-23 22:56:59 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-06-30 17:55:21 +0800 |
commit | 807f7e6579cb9f315bca4b6820d39e7a872c7868 (patch) | |
tree | 25ce8cb77aa7952b5c049532b23a4ef0072535c7 | |
parent | c81ab63779cde7bf5bf80d043bc0889d90cb1a3f (diff) | |
download | dexon-solidity-807f7e6579cb9f315bca4b6820d39e7a872c7868.tar.gz dexon-solidity-807f7e6579cb9f315bca4b6820d39e7a872c7868.tar.zst dexon-solidity-807f7e6579cb9f315bca4b6820d39e7a872c7868.zip |
Fixed checking of abstract functions.
Fixes #2264
-rw-r--r-- | libsolidity/SolidityNameAndTypeResolution.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libsolidity/SolidityNameAndTypeResolution.cpp b/libsolidity/SolidityNameAndTypeResolution.cpp index df976eae..4914ef97 100644 --- a/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/libsolidity/SolidityNameAndTypeResolution.cpp @@ -403,6 +403,23 @@ BOOST_AUTO_TEST_CASE(abstract_contract) BOOST_CHECK(derived->getDefinedFunctions()[0]->isFullyImplemented()); } +BOOST_AUTO_TEST_CASE(abstract_contract_with_overload) +{ + ASTPointer<SourceUnit> sourceUnit; + char const* text = R"( + contract base { function foo(bool); } + contract derived is base { function foo(uint) {} } + )"; + ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseTextAndResolveNames(text), "Parsing and name Resolving failed"); + std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->getNodes(); + ContractDefinition* base = dynamic_cast<ContractDefinition*>(nodes[0].get()); + ContractDefinition* derived = dynamic_cast<ContractDefinition*>(nodes[1].get()); + BOOST_REQUIRE(base); + BOOST_CHECK(!base->isFullyImplemented()); + BOOST_REQUIRE(derived); + BOOST_CHECK(!derived->isFullyImplemented()); +} + BOOST_AUTO_TEST_CASE(create_abstract_contract) { ASTPointer<SourceUnit> sourceUnit; |