bolt/rules/suspicious/index.bend fails
raw source on the hub · import 0x729eecea86ea5a2cdba3a2856a313bca/bolt/rules/suspicious/index.bend as Index
rule index: a def that calls itself also calls List.get(..) or
String.get(..). Both walk the cons list from the head to the index, so a
per-index loop is quadratic (AppSprout's sort went from 39 s to 0.9 s
walking the list itself). Walk the list in the recursion, or materialize
what the loop needs in one pass. A literal index (List.get(.., xs, 0n))
is a head access and exempt, as are laws and proofs.
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 0x729eecea86ea5a2cdba3a2856a313bca/bolt/config.bend:31). What bend.ts says:
Error:
- expected : a fresh name (duplicate declaration: Set)
- observed : 'Set'
Location:
30 | # a name (a group's or a rule's) at a level
31>| type Set is Data:
| ^^^
32 | Set{name: String, level: Level}