Credence.Semantic.UndefinedFunction
(credence v0.5.0)
Copy Markdown
Fixes compiler warnings about undefined or deprecated functions with known replacements.
LLMs sometimes use functions that don't exist in the expected module or have been deprecated in favour of a replacement. This rule maintains a mapping of known corrections.
Rename examples (module.function → module.function)
# Warning: Enum.last/1 is undefined or private
list |> Enum.last()
# Fixed:
list |> List.last()
# Warning: Enum.partition/2 is deprecated. Use Enum.split_with/2 instead
Enum.partition(list, &pred/1)
# Fixed:
Enum.split_with(list, &pred/1)Literal examples (hallucinated call → Elixir literal)
# Warning: Float.NegInfinity/0 is undefined or private
validate(root, Float.NegInfinity(), Float.PositiveInfinity())
# Fixed:
validate(root, :neg_infinity, :infinity)
# Warning: Float.inf/0 is undefined or private (often used as -Float.inf)
max_num = -Float.inf
# Fixed:
max_num = :neg_infinity