def unbanged

bend-lint-rules@0.2.0.0 · performance/gpu_fit.bend:229

import bend-lint-rules@0.2.0.0/performance/gpu_fit.bend as GpuFit
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint

229# The finding about a call of `info` without `!`, if it forks over numbers only and the caller does not
230# fork.
231def unbanged(
232  info: Maybe<&2, Lint.Def>,
233  callee: String,
234  +caller: Maybe<&2, Lint.Def>,
235  slots: List<&2, Slot>,
236  span: Maybe<&2, Lint.Span>
237) -> List<&2, Lint.Finding>:
238  match info:
239    case Some{Lint.Def{t, params, True{}, calls, r}}:
240      Lint.finding(
241        Lint.Hint{},
242        Bool.not(
243          Maybe.is_some(&2, Lint.Param, data(params, None{}, slots))
244        )
245          && Bool.not(Lint.Def.forks(caller))
246          && Bool.not(String.eq(t, Def.target(caller))),
247        span,
248        faster(callee)
249      )
250    case _:
251      []

Uses (19)

Used by (1)