def check.go
bolt@1.27.0.0 · src/rules/laws/closed.bend:34
import bolt@1.27.0.0/src/rules/laws/closed.bend as Closed
import Base
import bolt@1.27.0.0/src/finding.bend as F
import bolt@1.27.0.0/src/syntax/tree.bend as Tree
import bolt@1.27.0.0/src/lazy/lazy.bend as Lazy
import bolt@1.27.0.0/src/syntax/bind.bend as Bind
34def check.go(root: Tree.Node, +path: String) -> List<&2, F.Finding>:
35 match root:
36 case Tree.NCons{Tree.Stmt{Tree.SLaw{}, +kids, +body}, rest}:
37 +more = check.go(rest, path)
38 Lazy.stop(List<&2, F.Finding>, binds(body), more,
39 _u => F.Finding{path, Tree.line(kids), Tree.col(kids), 0, "closed",
40 "Law " ++ name.of(Bind.declared(kids))
41 ++ " has no `for` or `exs` binder, so it checks a single case; quantify it or delete it."} <> more)
42 case Tree.NCons{h, rest}:
43 check.go(rest, path)
44 case other:
45 Nil{}