nowarp / misti

TON Static Analyzer
https://nowarp.io/tools/misti
Apache License 2.0
30 stars 1 forks source link

`UnusedExpressionResult`: Report unused stdlib calls #217

Open Shvandre opened 2 weeks ago

Shvandre commented 2 weeks ago

Current behavior No warning

Expected behavior

@name(__tact_store_bool)
extends native storeBit(self: Builder, value: Bool): Builder;

asm(cell self) extends fun storeRef(self: Builder, cell: Cell): Builder { STREF }

those functions are not marked with "mutates" keyword, so return value should be used.

Input source

contract Sample {
    receive("Test") {
        let x: Builder = beginCell();
        x.storeBit(true);
        x.storeRef(beginCell().storeUint(3, 5).endCell());
    }
}

Error report file $ yarn misti ./tact.config.json -m info $ /home/b4cksl4sh/TON-Studio/tact-template/node_modules/.bin/misti ./tact.config.json -m info No errors found Done in 0.89s.

jubnzv commented 6 days ago

I prefer to lower asm functions to something more convenient to use to don't rewrite the implementation later (requires #74)