mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2697 from ethereum/unimplemented-inlined-library
Raise error when using unimplemented internal library functions.
This commit is contained in:
commit
41e724360f
@ -7,8 +7,9 @@ Bugfixes:
|
|||||||
* Code Generator: ``.delegatecall()`` should always return execution outcome.
|
* Code Generator: ``.delegatecall()`` should always return execution outcome.
|
||||||
* Code Generator: Provide "new account gas" for low-level ``callcode`` and ``delegatecall``.
|
* Code Generator: Provide "new account gas" for low-level ``callcode`` and ``delegatecall``.
|
||||||
* Type Checker: Constructors must be implemented if declared.
|
* Type Checker: Constructors must be implemented if declared.
|
||||||
* Type Checker: Do not mark overloaded functions as shadowing other functions.
|
|
||||||
* Type Checker: Disallow the ``.gas()`` modifier on ``ecrecover``, ``sha256`` and ``ripemd160``.
|
* Type Checker: Disallow the ``.gas()`` modifier on ``ecrecover``, ``sha256`` and ``ripemd160``.
|
||||||
|
* Type Checker: Do not mark overloaded functions as shadowing other functions.
|
||||||
|
* Type Checker: Internal library functions must be implemented if declared.
|
||||||
|
|
||||||
### 0.4.14 (2017-07-31)
|
### 0.4.14 (2017-07-31)
|
||||||
|
|
||||||
|
@ -518,6 +518,8 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
|
|||||||
_function.body().accept(*this);
|
_function.body().accept(*this);
|
||||||
else if (_function.isConstructor())
|
else if (_function.isConstructor())
|
||||||
m_errorReporter.typeError(_function.location(), "Constructor must be implemented if declared.");
|
m_errorReporter.typeError(_function.location(), "Constructor must be implemented if declared.");
|
||||||
|
else if (isLibraryFunction && _function.visibility() <= FunctionDefinition::Visibility::Internal)
|
||||||
|
m_errorReporter.typeError(_function.location(), "Internal library function must be implemented if declared.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6536,6 +6536,28 @@ BOOST_AUTO_TEST_CASE(constructor_without_implementation)
|
|||||||
CHECK_ERROR(text, TypeError, "Constructor must be implemented if declared.");
|
CHECK_ERROR(text, TypeError, "Constructor must be implemented if declared.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(library_function_without_implementation)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
library L {
|
||||||
|
function f();
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_SUCCESS_NO_WARNINGS(text);
|
||||||
|
text = R"(
|
||||||
|
library L {
|
||||||
|
function f() internal;
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_ERROR(text, TypeError, "Internal library function must be implemented if declared.");
|
||||||
|
text = R"(
|
||||||
|
library L {
|
||||||
|
function f() private;
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_ERROR(text, TypeError, "Internal library function must be implemented if declared.");
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user