ViewPureChecker::reportMutability: don't check visibility on constructors.

This commit is contained in:
Alexander Arlt
2020-09-07 11:35:33 -05:00
parent 2b29f4e56d
commit df8bbeeb22
4 changed files with 23 additions and 5 deletions
@@ -0,0 +1,8 @@
contract C {
uint256 value;
constructor() {
value = msg.value;
}
}
// ----
// TypeError 5887: (68-77): "msg.value" and "callvalue()" can only be used in payable constructors. Make the constructor "payable" to avoid this error.
@@ -0,0 +1,7 @@
contract C {
function get() public view returns(uint256) {
return msg.value;
}
}
// ----
// TypeError 5887: (78-87): "msg.value" and "callvalue()" can only be used in payable public functions. Make the function "payable" or use an internal function to avoid this error.