mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Tests for changing virtual function mutability when overriding
This commit is contained in:
parent
5687f6e934
commit
fc7cd54849
@ -0,0 +1,23 @@
|
||||
contract A {
|
||||
function f() internal virtual {
|
||||
mutableWithViewOverride();
|
||||
mutableWithPureOverride();
|
||||
viewWithPureOverride();
|
||||
}
|
||||
|
||||
function mutableWithViewOverride() internal virtual {}
|
||||
function mutableWithPureOverride() internal virtual {}
|
||||
function viewWithPureOverride() internal view virtual {}
|
||||
}
|
||||
|
||||
contract C is A {
|
||||
function run() public {
|
||||
f();
|
||||
}
|
||||
|
||||
function mutableWithViewOverride() internal view override {}
|
||||
function mutableWithPureOverride() internal pure override {}
|
||||
function viewWithPureOverride() internal pure override {}
|
||||
}
|
||||
// ----
|
||||
// run() ->
|
@ -0,0 +1,23 @@
|
||||
contract A {
|
||||
function f() internal virtual {
|
||||
mutableWithViewOverride();
|
||||
mutableWithPureOverride();
|
||||
viewWithPureOverride();
|
||||
}
|
||||
|
||||
function mutableWithViewOverride() public virtual {}
|
||||
function mutableWithPureOverride() public virtual {}
|
||||
function viewWithPureOverride() public view virtual {}
|
||||
}
|
||||
|
||||
contract C is A {
|
||||
function run() public {
|
||||
f();
|
||||
}
|
||||
|
||||
function mutableWithViewOverride() public view override {}
|
||||
function mutableWithPureOverride() public pure override {}
|
||||
function viewWithPureOverride() public pure override {}
|
||||
}
|
||||
// ----
|
||||
// run() ->
|
Loading…
Reference in New Issue
Block a user