mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Implement override checking
This commit is contained in:
@@ -2,5 +2,5 @@ interface D {
|
||||
function f() view external;
|
||||
}
|
||||
contract C is D {
|
||||
function f() view external {}
|
||||
function f() override view external {}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@ contract D {
|
||||
function g() public pure {}
|
||||
}
|
||||
contract C1 is D {
|
||||
function f() public {}
|
||||
function g() public view {}
|
||||
function f() public override {}
|
||||
function g() public override view {}
|
||||
}
|
||||
contract C2 is D {
|
||||
function g() public {}
|
||||
function g() public override {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (118-140): Overriding function changes state mutability from "view" to "nonpayable".
|
||||
// TypeError: (145-172): Overriding function changes state mutability from "pure" to "view".
|
||||
// TypeError: (198-220): Overriding function changes state mutability from "pure" to "nonpayable".
|
||||
// TypeError: (118-149): Overriding function changes state mutability from "view" to "nonpayable".
|
||||
// TypeError: (154-190): Overriding function changes state mutability from "pure" to "view".
|
||||
// TypeError: (216-247): Overriding function changes state mutability from "pure" to "nonpayable".
|
||||
|
||||
@@ -3,5 +3,5 @@ contract D {
|
||||
function f() public { x = 2; }
|
||||
}
|
||||
contract C is D {
|
||||
function f() public {}
|
||||
function f() public override {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user