Credence.Semantic.UndefinedStringAlphanumeric (credence v0.6.0)

Copy Markdown

Fixes the common LLM hallucination where String.alphanumeric?/1 is called as if it were a real Elixir standard library function. It is not.

LLMs translating Python's str.isalnum() frequently produce:

Enum.filter(&String.alphanumeric?/1)

This compiles but warns String.alphanumeric?/1 is undefined or private, which becomes a hard error under --warnings-as-errors.

The fix replaces:

  • &String.alphanumeric?/1fn char -> String.match?(char, ~r/^[a-zA-Z0-9]$/) end
  • String.alphanumeric?(expr)String.match?(expr, ~r/^[a-zA-Z0-9]$/)