Files
mercury/tests/warnings/occurs.exp
Zoltan Somogyi 9a909ddc7f Avoid misleading occurs check warnings.
compiler/superhomogeneous.m:
    Record a unification between X and f(Yi) as possibly leading to
    an occurs check warning only if f is known to be a data constructor,
    either user defined or the builtin tuple constructor.

compiler/hlds_cons.m:
    Add a version of the search_cons_table predicate that does not construct
    the list of hlds_cons_defns that match the given cons_id. The new code
    in superhomogeneous.m needs to know whether a cons_id is a known data
    constructor, but it does not need to know its matching definitions,
    and constructing that list is reasonably expensive when it has to be
    executed for every single function symbol in every clause.

    Add some documentation of the existing predicates, and separate their
    implementations from each other with lines.

tests/warnings/occurs.{m,exp}:
    Extend this test case both with a unifications we should warn about
    (a circular unification whose top level cons_id is a tuple constructor)
    and one we should not warn about (when the cons_is is NOT a data
    constructor of any kind).

compiler/implementation_defined_literals.m:
compiler/prog_data.m:
    Clarify related documentation.
2020-04-15 02:57:16 +10:00

5 lines
196 B
Plaintext

occurs.m:026: Warning: the variable `A' is unified with a term containing
occurs.m:026: itself.
occurs.m:037: Warning: the variable `B' is unified with a term containing
occurs.m:037: itself.