def gaps

bolt@1.27.0.0 · src/rules/laws/law.bend:126

import bolt@1.27.0.0/src/rules/laws/law.bend as Law
import Base
import bolt@1.27.0.0/src/lazy/lazy.bend as Lazy
import bolt@1.27.0.0/src/finding.bend as F
import bolt@1.27.0.0/src/syntax/outline.bend as Outline
import bolt@1.27.0.0/src/rules/digest.bend as Digest
import bolt@1.27.0.0/src/rules/imports.bend as Imports

126# a def, or a type, that no law reaches
127def gaps(ts: List<&2, Digest.Top>, +cl: List<&2, String>, +pp: String, +path: String) -> List<&2, F.Finding>:
128  match ts:
129    case Nil{}:
130      Nil{}
131    case Con{Digest.Top{Outline.IDef{}, +name, +line, cs, calls}, rest}:
132      +more = gaps(rest, cl, pp, path)
133      Bool.pick(List<&2, F.Finding>,
134        Lazy.or_else(String.contains(name, "."), _u => Imports.has(cl, key(pp, name))), more,
135        F.Finding{path, line, 0, 0, "coverage", "No quantified law reaches def " ++ name ++ "."} <> more)
136    case Con{Digest.Top{Outline.IType{}, +name, +line, cs, calls}, rest}:
137      +more = gaps(rest, cl, pp, path)
138      Bool.pick(List<&2, F.Finding>, Lazy.or_else(Imports.has(cl, key(pp, name)), _u => any_item(cs, cl, pp)), more,
139        F.Finding{path, line, 0, 0, "coverage", "No quantified law reaches type " ++ name ++ " or any of its constructors."}
140          <> more)
141    case Con{other, rest}:
142      gaps(rest, cl, pp, path)

Uses (12)

Used by (1)