aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/syntaxTests/viewPureChecker/modifiers_fail.sol
blob: 513850f772151ce95a5236d55ba7829261f64f66 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
contract D {
    uint x;
    modifier viewm(uint) { uint a = x; _; a; }
    modifier nonpayablem(uint) { x = 2; _; }
}
contract C is D {
    function f() viewm(0) pure public {}
    function g() nonpayablem(0) view public {}
}
// ----
// TypeError: (154-162): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
// TypeError: (195-209): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.