mutability.sol 297 B

1234567891011121314151617
  1. contract C {
  2. bool x;
  3. int[4] a;
  4. function test() public view returns (int) {
  5. return foo()[1];
  6. }
  7. function foo() internal returns (int[4] storage) {
  8. x = true;
  9. return a;
  10. }
  11. }
  12. // ---- Expect: diagnostics ----
  13. // error: 6:10-15: function declared 'view' but this expression writes to state