~/bend-docscommunity

bolt/rules/suspicious/strict.bend fails

raw source on the hub · import 0x729eecea86ea5a2cdba3a2856a313bca/bolt/rules/suspicious/strict.bend as Strict

rule strict: a def calls itself inside an operand of Bool.and(..) or Bool.or(..), or on either side of && or ||. They are functions, not short-circuits: both sides always run (timed: False{} && f(x) costs all of f), so ok(h) && go(rest) walks the whole input after the answer is known, and the pending operator keeps a frame per step (the JS lane overflowed at ~64K this way). Match on the Bool in a helper, or carry it as an argument: go(rest, ok(h)). A self-call bound by a let above is not flagged: binding it says both run.

7 imports
import Base
import ../../src.bend as Src
import ../../finding.bend as F
import ../../../syntax/lex.bend as Lex
import ../../../syntax/tree.bend as Tree
import ../calls.bend as Calls
import ../../../lazy/lazy.bend as Lazy