tact-lang / tact

Tact compiler main repository
https://tact-lang.org
MIT License
394 stars 110 forks source link

Calling mutating methods on constants fails with a FunC compilation error #675

Closed anton-trunov closed 3 months ago

anton-trunov commented 3 months ago
extends mutates fun inc(self: Int) {
    self += 1;
}

const C1: Int = 42;

contract Test {

    get fun foo(): Int {
        42.inc(); // this is fine
        C1.inc(); // <---- produces FunC compilation error
        return 42;
    }
}

fails to compile with the following error message:

error: lvalue expected before `~$Int$_fun_inc`
      42~$Int$_fun_inc();

It seems to me a not_mut wrapper does not get applied in this case.