solidity/test/libsolidity/syntaxTests/viewPureChecker/overriding_fail.sol

17 lines
573 B
Solidity
Raw Normal View History

2018-07-04 09:25:45 +00:00
contract D {
uint x;
2019-11-05 17:25:34 +00:00
function f() public virtual view { x; }
function g() public virtual pure {}
2018-07-04 09:25:45 +00:00
}
contract C1 is D {
2019-09-16 12:33:43 +00:00
function f() public override {}
2019-11-05 17:25:34 +00:00
function g() public virtual override view {}
2018-07-04 09:25:45 +00:00
}
contract C2 is D {
2019-09-16 12:33:43 +00:00
function g() public override {}
2018-07-04 09:25:45 +00:00
}
// ----
2019-11-05 17:25:34 +00:00
// TypeError: (134-165): Overriding function changes state mutability from "view" to "nonpayable".
// TypeError: (170-214): Overriding function changes state mutability from "pure" to "view".
// TypeError: (240-271): Overriding function changes state mutability from "pure" to "nonpayable".