Files
mercury/tests/invalid/mode_inf.err_exp
Zoltan Somogyi 0ab6993894 Convert mode analysis to use var_tables.
compiler/instmap.m:
compiler/mode_comparison.m:
compiler/mode_debug.m:
compiler/mode_info.m:
compiler/modecheck_call.m:
compiler/modecheck_coerce.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/modes.m:
compiler/unique_modes.m:
    Convert these modules to use var_tables.

compiler/mode_errors.m:
    Convert this module to use var_tables.

    Fix an ancient error that I think has escaped detection until now
    because it arises only in the presence of a mode error in a procedure
    whose mode is being inferred. The bug is that when we modecheck a call,
    say from p to q, and find no matching modes in the callee because
    its mode inference has generated errors, then we report those errors
    in the callee as part of the explanation of the error in the caller.
    That is fine. What was not fine is that we printed any variables
    in the callee's mode_error using the *caller's* varset. We now
    print them using the callee's var table.

compiler/type_util.m:
    Add a var_table-using variant of an existing predicate,
    for use in new code above.

compiler/pd_util.m:
    Conform to the changes above.

tests/invalid/mode_inf.m:
    Modify this test case to make the caller and callee use disjoint
    sets of variable names, which is probably why the incorrect variables
    in the error message about the callee has not been noticed.

tests/invalid/mode_inf.err_exp:
    Expect the updated, and now correct, version of that error message.
2022-05-02 11:36:42 +10:00

15 lines
751 B
Plaintext

mode_inf.m:014: In clause for `p(out, out)':
mode_inf.m:014: in call to predicate `mode_inf.q'/2:
mode_inf.m:014: mode error: arguments `X, Y' have the following insts:
mode_inf.m:014: free,
mode_inf.m:014: free
mode_inf.m:014: which does not match any of the valid modes for the callee
mode_inf.m:014: (predicate `mode_inf.q'/2)
mode_inf.m:014: because of the following error.
mode_inf.m:016: In clause for `q(out(not_reached), out(not_reached))':
mode_inf.m:016: in argument 2 of clause head:
mode_inf.m:016: mode error in unification of `Z' and `Z'.
mode_inf.m:016: Variable `Z' has instantiatedness `free',
mode_inf.m:016: variable `Z' has instantiatedness `free'.
mode_inf.m:016: REJECTED :- mode q(out(...), out(...)).