Skip to main content

Module lint

Module lint 

Source
Expand description

Static lint: calls to predicates that are defined nowhere.

patch-prolog is a whole-program compiler with no assert/retract, so the complete predicate set is known at compile time. A direct body goal that calls a predicate with no clauses, no :- dynamic declaration, and which is not a builtin or stdlib predicate can never succeed — at runtime it raises existence_error(procedure, F/A).

ISO requires that error to stay a catchable runtime condition (so catch/3 of an undefined call works), which is why callers treat this as a warning by default and only promote it to an error on request (plgc … --deny-undefined).

Lives in the frontend so BOTH the compiler and the LSP can run it without pulling in codegen or the runtime. Only direct, statically-resolvable calls are checked; runtime-built goals (a variable goal, call/N with N>1) are left to the runtime.

Structs§

Undefined
An undefined-predicate reference, rendered for display.

Functions§

message
Format a lint as <predicate> ... [— did you mean <x>?].
undefined_calls
Collect every (caller, callee) where a clause body directly calls a predicate that is defined nowhere. Deduplicated and deterministically ordered. clauses/directives must be the FULL compilation unit (stdlib included) so stdlib calls are not flagged.