Tests for changing virtual function mutability when overriding

This commit is contained in:
Kamil Śliwak 2023-04-06 12:53:30 +02:00
parent 5687f6e934
commit fc7cd54849
2 changed files with 46 additions and 0 deletions

View File

@ -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() ->

View File

@ -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() ->