Credence.Pattern.HallucinatedGuard (credence v0.4.4)

Copy Markdown

Fixes calls to guard functions that don't exist in Elixir.

LLMs sometimes hallucinate guard names from Erlang typespecs or other languages. This rule detects known hallucinated guards and replaces them with their correct Elixir equivalents.

Replacements

is_pos_integer(x)        is_integer(x) and x > 0
is_non_neg_integer(x)    is_integer(x) and x >= 0
is_neg_integer(x)        is_integer(x) and x < 0
is_non_pos_integer(x)    is_integer(x) and x <= 0