def search.cite

bolt@1.27.0.0 · src/rules/correctness/pick.bend:209

import bolt@1.27.0.0/src/rules/correctness/pick.bend as Pick
import Base
import bolt@1.27.0.0/src/finding.bend as F

209# the finding at the bound self-call; tail: the else branch is the bound
210# name alone, so the call can carry the test instead
211def search.cite(+ll: U32, +cc: U32, +name: String, +path: String, tail: Bool) -> F.Finding:
212  match tail:
213    case True{}:
214      F.Finding{path, ll, cc, U32.from_nat(String.length(name)), "pick",
215        name ++ " binds its own call above a Bool.pick that reads it only in the else branch, so the walk runs even when the condition holds and the search never stops early; carry the test as a Bool into the next call (`go(rest, k, test(h))`) and `match hit` first, so the search stops and stays a loop."}
216    case False{}:
217      F.Finding{path, ll, cc, U32.from_nat(String.length(name)), "pick",
218        name ++ " binds its own call above a Bool.pick that reads it only in the else branch, so the walk runs even when the condition holds and the search never stops early; branch with `match` on the condition in a helper that takes it as a parameter, so the call runs only in the branch that needs it."}

Uses (7)

Used by (1)