def message
bend-lint-rules@0.2.0.0 · language/decreasing_call.bend:204
import bend-lint-rules@0.2.0.0/language/decreasing_call.bend as DecreasingCall
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint
204def message(verdict: Verdict, loop: String, source: String, args: List<&2, Lint.Node>) -> String:
205 match verdict:
206 case Fails{+at, param}:
207 loop
208 ++ " calls itself here, but argument "
209 ++ ordinal(at)
210 ++ " (`"
211 ++ Lint.Span.text(source, Lint.Node.span(List.get(&2, Lint.Node, args, at)))
212 ++ "`) is neither the parameter "
213 ++ param
214 ++ " unchanged nor a part of it that a match took apart, and the arguments before it are unchanged. Bend reads the arguments left to right, so it cannot prove the loop ends, and the check fails (\"a decreasing self-call\"). Put the parameter that shrinks first, pass the ones before it unchanged, and pass a part of it that a match took apart (`p` of `case 1n+p:`)."
215 case _:
216 loop
217 ++ " calls itself here with every argument unchanged, so the loop would never end, and the check fails (\"a decreasing self-call\"). Pass a part of the parameter that shrinks, one that a match took apart (`p` of `case 1n+p:`)."