aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/syntaxTests/viewPureChecker/modifiers_fail.sol
diff options
context:
space:
mode:
Diffstat (limited to 'test/libsolidity/syntaxTests/viewPureChecker/modifiers_fail.sol')
-rw-r--r--test/libsolidity/syntaxTests/viewPureChecker/modifiers_fail.sol12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/viewPureChecker/modifiers_fail.sol b/test/libsolidity/syntaxTests/viewPureChecker/modifiers_fail.sol
new file mode 100644
index 00000000..513850f7
--- /dev/null
+++ b/test/libsolidity/syntaxTests/viewPureChecker/modifiers_fail.sol
@@ -0,0 +1,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.
>108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158