mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Show unimplemented function if trying to instantiate an abstract class
This commit is contained in:
parent
c835bcec62
commit
494dea262e
@ -1,6 +1,7 @@
|
|||||||
### 0.4.15 (unreleased)
|
### 0.4.15 (unreleased)
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
* Type Checker: Show unimplemented function if trying to instantiate an abstract class.
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Code Generator: ``.delegatecall()`` should always return execution outcome.
|
* Code Generator: ``.delegatecall()`` should always return execution outcome.
|
||||||
|
@ -1523,7 +1523,14 @@ void TypeChecker::endVisit(NewExpression const& _newExpression)
|
|||||||
if (!contract)
|
if (!contract)
|
||||||
m_errorReporter.fatalTypeError(_newExpression.location(), "Identifier is not a contract.");
|
m_errorReporter.fatalTypeError(_newExpression.location(), "Identifier is not a contract.");
|
||||||
if (!contract->annotation().unimplementedFunctions.empty())
|
if (!contract->annotation().unimplementedFunctions.empty())
|
||||||
m_errorReporter.typeError(_newExpression.location(), "Trying to create an instance of an abstract contract.");
|
m_errorReporter.typeError(
|
||||||
|
_newExpression.location(),
|
||||||
|
SecondarySourceLocation().append(
|
||||||
|
"Missing implementation:",
|
||||||
|
contract->annotation().unimplementedFunctions.front()->location()
|
||||||
|
),
|
||||||
|
"Trying to create an instance of an abstract contract."
|
||||||
|
);
|
||||||
if (!contract->constructorIsPublic())
|
if (!contract->constructorIsPublic())
|
||||||
m_errorReporter.typeError(_newExpression.location(), "Contract with internal constructor cannot be created directly.");
|
m_errorReporter.typeError(_newExpression.location(), "Contract with internal constructor cannot be created directly.");
|
||||||
|
|
||||||
|
@ -151,6 +151,16 @@ void ErrorReporter::syntaxError(SourceLocation const& _location, string const& _
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ErrorReporter::typeError(SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description)
|
||||||
|
{
|
||||||
|
error(
|
||||||
|
Error::Type::TypeError,
|
||||||
|
_location,
|
||||||
|
_secondaryLocation,
|
||||||
|
_description
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void ErrorReporter::typeError(SourceLocation const& _location, string const& _description)
|
void ErrorReporter::typeError(SourceLocation const& _location, string const& _description)
|
||||||
{
|
{
|
||||||
error(
|
error(
|
||||||
|
@ -73,6 +73,12 @@ public:
|
|||||||
|
|
||||||
void syntaxError(SourceLocation const& _location, std::string const& _description);
|
void syntaxError(SourceLocation const& _location, std::string const& _description);
|
||||||
|
|
||||||
|
void typeError(
|
||||||
|
SourceLocation const& _location,
|
||||||
|
SecondarySourceLocation const& _secondaryLocation,
|
||||||
|
std::string const& _description
|
||||||
|
);
|
||||||
|
|
||||||
void typeError(SourceLocation const& _location, std::string const& _description);
|
void typeError(SourceLocation const& _location, std::string const& _description);
|
||||||
|
|
||||||
void fatalTypeError(SourceLocation const& _location, std::string const& _description);
|
void fatalTypeError(SourceLocation const& _location, std::string const& _description);
|
||||||
|
Loading…
Reference in New Issue
Block a user