mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Implement and fix overriding unimplemented and implemented functions with unimplemented functions.
This commit is contained in:
committed by
chriseth
parent
2c72ee7017
commit
426f04b389
@@ -0,0 +1,15 @@
|
||||
abstract contract A {
|
||||
function f() external virtual;
|
||||
}
|
||||
abstract contract B {
|
||||
function f() external virtual {}
|
||||
}
|
||||
abstract contract C is A, B {
|
||||
function f() external virtual override(A, B);
|
||||
}
|
||||
abstract contract D is B, A {
|
||||
function f() external virtual override(A, B);
|
||||
}
|
||||
// ----
|
||||
// TypeError: (154-199): Overriding an implemented function with an unimplemented function is not allowed.
|
||||
// TypeError: (236-281): Overriding an implemented function with an unimplemented function is not allowed.
|
||||
@@ -0,0 +1,9 @@
|
||||
interface A {
|
||||
function f() external;
|
||||
}
|
||||
interface B {
|
||||
function f() external;
|
||||
}
|
||||
abstract contract C is A, B {
|
||||
function f() external virtual override(A, B);
|
||||
}
|
||||
+1
-1
@@ -2,4 +2,4 @@ abstract contract base { function foo() public virtual; }
|
||||
contract derived is base { function foo() public virtual override {} }
|
||||
contract wrong is derived { function foo() public virtual override; }
|
||||
// ----
|
||||
// TypeError: (157-196): Redeclaring an already implemented function as abstract
|
||||
// TypeError: (157-196): Overriding an implemented function with an unimplemented function is not allowed.
|
||||
|
||||
Reference in New Issue
Block a user