Commit Graph

3 Commits

Author SHA1 Message Date
Zoltan Somogyi
660cfe4f83 s/predicate symbol predicate/predicate symbol/ in a diagnostic.
We used to generate diagnostics of the form

    The predicate symbol predicate `<'/2 is also overloaded here.

The second "predicate" is pure noise. It could never be "function",
even though the code generating that message was prepared for that.

compiler/typecheck.m:
    When typechecking a *predicate* call, don't specify the predicate
    being called using a data structure that can also refer to functions.

compiler/typecheck_info.m:
    When representing an overloaded predicate name, as opposed to
    an overloaded function name, don't include a pred_or_func indication
    that should *always* be pf_predicate.

compiler/typecheck_errors.m:
    When reporting an overloaded predicate name, or talking about a
    predicate's argument vector, do not take a pred_or_func indication,
    since it should *always* be pf_predicate.

tests/invalid/ambiguous_overloading_error.err_exp:
tests/warnings/ambiguous_overloading.exp:
    Don't expect the redundant "predicate" in the overload error message.

tests/invalid/max_error_line_width.err_exp:
tests/invalid/max_error_line_width.m:
    The deletion of the redundant "predicate" in overload error messages
    made them all fit on one line, robbing this test of its task of testing
    longer-than-80-column output lines. Change the test so that the overload
    is not between int.< and float.<, but between the unchecked_left_shift
    functions in int and uint, since the longer function name yields error
    message lines in the length range this test case wants to test.

tests/invalid/ambiguous_overloading_error.m:
tests/invalid/arg_permutation.m:
tests/invalid/assert_in_interface.m:
tests/invalid/bad_detism_category.m:
    Fix programming style.

tests/invalid/assert_in_interface.err_exp:
    Update a line number.
2020-10-26 20:28:18 +11:00
Zoltan Somogyi
fdd141bf77 Clean up the tests in the other test directories.
tests/invalid/*.{m,err_exp}:
tests/misc_tests/*.m:
tests/mmc_make/*.m:
tests/par_conj/*.m:
tests/purity/*.m:
tests/stm/*.m:
tests/string_format/*.m:
tests/structure_reuse/*.m:
tests/submodules/*.m:
tests/tabling/*.m:
tests/term/*.m:
tests/trailing/*.m:
tests/typeclasses/*.m:
tests/valid/*.m:
tests/warnings/*.{m,exp}:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the tests
    that check compiler error messages, expect the new line numbers.

browser/cterm.m:
browser/tree234_cc.m:
    Import only one module per line.

tests/hard_coded/boyer.m:
    Fix something I missed.
2015-02-16 12:32:18 +11:00
Zoltan Somogyi
464e6ab4e7 Generate better messages for type errors in call arguments.
compiler/typecheck_errors.m:
    When generating reports for type errors, return a record of the
    actual and the expected types if they are both unambiguous.

    Add a function to report type errors in two or more arguments of a call,
    for two reasons. The first is to eliminate the duplicate reporting
    of the identity of the called predicate, and (if verbose errors are
    enabled) of the partial type assignment. The second is so that
    we can tell the user about matches between the actual type of
    one erroneous argument and the expected type of another, which usually
    indicates that the call had the right arguments in the wrong order.

    To make the above easier to implement, separate the concepts of
    the argument vector of a term (such as a call or clause head)
    and a vector of variables that is *not* an argument vector.

compiler/typecheck.m:
    If two or more arguments of a call have type errors in which
    both the actual and expected types are unambiguous, invoke
    the new function in typecheck_errors.m to report them together.

    Conform to the other changes in typecheck_errors.m.

tests/invalid/arg_permutation.{m,err_exp}:
    New test case to test the new error messages.

tests/invalid/Mmakefile:
    Enable the new test case.

tests/invalid/comparison.err_exp:
tests/invalid/illtyped_compare.err_exp:
    Expect the updated error messages.
2015-01-21 11:48:44 +11:00