Merge pull request #2887 from ethereum/missing-functions-list

Show each unimplemented function in secondary source location
This commit is contained in:
chriseth 2017-09-12 13:28:49 +02:00 committed by GitHub
commit ac3742cd25

View File

@ -1583,14 +1583,16 @@ void TypeChecker::endVisit(NewExpression const& _newExpression)
if (contract->contractKind() == ContractDefinition::ContractKind::Interface)
m_errorReporter.fatalTypeError(_newExpression.location(), "Cannot instantiate an interface.");
if (!contract->annotation().unimplementedFunctions.empty())
{
SecondarySourceLocation ssl;
for (auto function: contract->annotation().unimplementedFunctions)
ssl.append("Missing implementation:", function->location());
m_errorReporter.typeError(
_newExpression.location(),
SecondarySourceLocation().append(
"Missing implementation:",
contract->annotation().unimplementedFunctions.front()->location()
),
ssl,
"Trying to create an instance of an abstract contract."
);
}
if (!contract->constructorIsPublic())
m_errorReporter.typeError(_newExpression.location(), "Contract with internal constructor cannot be created directly.");