Warns if modifier uses msg.value in non-payable function.

This commit is contained in:
Erik Kundt
2018-09-03 18:35:57 +02:00
committed by chriseth
parent 378f691608
commit 75a92b0ffd
11 changed files with 129 additions and 65 deletions
@@ -0,0 +1,6 @@
contract C {
modifier m(uint _amount, uint _avail) { require(_avail >= _amount); _; }
function f() m(1 ether, msg.value) public pure {}
}
// ----
// TypeError: (118-127): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
@@ -0,0 +1,6 @@
contract C {
modifier m(uint _amount, uint _avail) { require(_avail >= _amount); _; }
function f() m(1 ether, msg.value) public view {}
}
// ----
// Warning: (118-127): "msg.value" used in non-payable function. Do you want to add the "payable" modifier to this function?