everx-labs / TVM-Solidity-Compiler

Solidity compiler for TVM
GNU General Public License v3.0
125 stars 72 forks source link

Pure function from lib potentially modifies the state #41

Closed laugan-ton closed 1 year ago

laugan-ton commented 3 years ago

Here is what I get:

Error: Function declared as view, but this expression (potentially) modifies the state and thus requires the default.

File (ErrorA.sol):

pragma ton-solidity >=0.38.2;

library A {

    function calc(uint128 value) public pure returns (uint128) {
        return value++;
    }
}

contract B {

    uint128 constant VAL = 1;

    function make() external view {
        A.calc(VAL);
    }
}

As you can see there are:

Still, compiler shows error. Tested with 0.38.2.

ilyar commented 2 years ago

the error is not reproduced since v0.51.0 version:

npx tondev sol set --compiler 0.51.0 --stdlib 0.51.0
npx tondev sol compile ErrorA.sol
cryshado commented 1 year ago

No longer relevant in new compiler versions