src/rules/suspicious/strict.bend fails
raw source on the hub · import 0xde9bb08f7de298b03207fb5797ede9a5/src/rules/suspicious/strict.bend as Strict
rule strict: a def calls itself inside an operand of Bool.and(..) or
Bool.or(..), or in a comma-separated stretch holding && or || (either
side of the operator), matched by that exact text
(a qualified Base.Bool.or is not seen). 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. Nor is one in a lambda body (_u => go(rest), as
Lazy.or_else takes): a thunk does not run eagerly, unless the body itself
holds && or ||. A => ends the stretch on its left, so a body's && or
|| never reaches back past it: go(x) <> _u => a && b is not flagged.
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
The reader could not load this file (at 0xde9bb08f7de298b03207fb5797ede9a5/src/config.bend:32). What bend.ts says:
Error:
- expected : a fresh name (duplicate declaration: Set)
- observed : 'Set'
Location:
31 | # a name (a group's or a rule's) at a level
32>| type Set is Data:
| ^^^
33 | Set{name: String, level: Level}