aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-03-22 01:12:08 +0800
committerchriseth <chris@ethereum.org>2017-03-22 01:12:08 +0800
commit4792806b9940562184fab169923efe318e5b7793 (patch)
treeed3aaf080469b1367fd27fae56bcb82b076d0458 /libsolidity
parent766fa2fe85cd0c2bb8f29dc4d4deac928a86265a (diff)
downloaddexon-solidity-4792806b9940562184fab169923efe318e5b7793.tar.gz
dexon-solidity-4792806b9940562184fab169923efe318e5b7793.tar.zst
dexon-solidity-4792806b9940562184fab169923efe318e5b7793.zip
Fix: Contract inheriting from base with unimplemented constructor is abstract.
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 30e84f11..dc04404d 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -187,13 +187,20 @@ void TypeChecker::checkContractAbstractFunctions(ContractDefinition const& _cont
using FunTypeAndFlag = std::pair<FunctionTypePointer, bool>;
map<string, vector<FunTypeAndFlag>> functions;
+ bool allBaseConstructorsImplemented = true;
// Search from base to derived
for (ContractDefinition const* contract: boost::adaptors::reverse(_contract.annotation().linearizedBaseContracts))
for (FunctionDefinition const* function: contract->definedFunctions())
{
// Take constructors out of overload hierarchy
if (function->isConstructor())
+ {
+ if (!function->isImplemented())
+ // Base contract's constructor is not fully implemented, no way to get
+ // out of this.
+ allBaseConstructorsImplemented = false;
continue;
+ }
auto& overloads = functions[function->name()];
FunctionTypePointer funType = make_shared<FunctionType>(*function);
auto it = find_if(overloads.begin(), overloads.end(), [&](FunTypeAndFlag const& _funAndFlag)
@@ -211,6 +218,9 @@ void TypeChecker::checkContractAbstractFunctions(ContractDefinition const& _cont
it->second = true;
}
+ if (!allBaseConstructorsImplemented)
+ _contract.annotation().isFullyImplemented = false;
+
// Set to not fully implemented if at least one flag is false.
for (auto const& it: functions)
for (auto const& funAndFlag: it.second)