language/unneeded_plus.bend fails
raw source on the hub · import bend-lint-rules@0.1.0.0/language/unneeded_plus.bend as Unneeded_plus
language/unneeded_plus: a binder written with + that its body uses at most once on each path, so the
+ claims a reuse that never happens.
Heuristics: it reads how often the checker found each binder used, the most over its branches. A
binder that a match or a let takes apart is skipped: its + also makes its fields reusable. So is a
parameter of a definition used as a value (OnFile{run}): the type it must have can ask for the +.
The + costs no speed: the compiler counts references from the uses, not from the +. Removing
1,049 such + from Bend's slash boss demo, three-bodies and a raytracer left their C unchanged.
3 imports
import Base import bend-lint-api@0.1.0.0/linter/lint.bend as Lint import bend-lint-api@0.1.0.0/shared/lists.bend as Lists
The reader could not load this file (at 0x2b0a0dcada30f71a8eb4ec2e148b9279/linter/lint.bend:522). What bend.ts says:
Error:
- expected : a fresh constructor name (duplicate declaration: Text)
- observed : 'Text'
Location:
521 | Flag{on: Bool}
522>| Text{text: String}
| ^^^^
523 |