mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8585 from ethereum/virtual-library-function
Added error message for virtual (library) functions; test case
This commit is contained in:
commit
a1b28953a5
@ -21,6 +21,7 @@ Bugfixes:
|
|||||||
* Inline Assembly: Fix internal error when accessing incorrect constant variables.
|
* Inline Assembly: Fix internal error when accessing incorrect constant variables.
|
||||||
* Inheritance: Allow public state variables to override functions with dynamic memory types in their return values.
|
* Inheritance: Allow public state variables to override functions with dynamic memory types in their return values.
|
||||||
* JSON AST: Always add pointer suffix for memory reference types.
|
* JSON AST: Always add pointer suffix for memory reference types.
|
||||||
|
* Type Checker: Disallow virtual for library functions.
|
||||||
|
|
||||||
|
|
||||||
### 0.6.4 (2020-03-10)
|
### 0.6.4 (2020-03-10)
|
||||||
|
@ -332,6 +332,8 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
|
|||||||
m_errorReporter.warning(_function.location(), "Interface functions are implicitly \"virtual\"");
|
m_errorReporter.warning(_function.location(), "Interface functions are implicitly \"virtual\"");
|
||||||
if (_function.visibility() == Visibility::Private)
|
if (_function.visibility() == Visibility::Private)
|
||||||
m_errorReporter.typeError(_function.location(), "\"virtual\" and \"private\" cannot be used together.");
|
m_errorReporter.typeError(_function.location(), "\"virtual\" and \"private\" cannot be used together.");
|
||||||
|
if (isLibraryFunction)
|
||||||
|
m_errorReporter.typeError(_function.location(), "Library functions cannot be \"virtual\".");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_function.isPayable())
|
if (_function.isPayable())
|
||||||
|
@ -177,7 +177,6 @@ library Math {
|
|||||||
/// @param nums Numbers to look through
|
/// @param nums Numbers to look through
|
||||||
/// @return max Maximum number
|
/// @return max Maximum number
|
||||||
function max(int[] memory nums)
|
function max(int[] memory nums)
|
||||||
virtual
|
|
||||||
public
|
public
|
||||||
pure
|
pure
|
||||||
returns (int max)
|
returns (int max)
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
library L {
|
||||||
|
function f() internal pure virtual returns (uint) { return 0; }
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// TypeError: (16-79): Library functions cannot be "virtual".
|
Loading…
Reference in New Issue
Block a user