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
a23873984b In the presence of large amounts of unresolved overloading, the compiler could
Estimated hours taken: 6
Branches: main

In the presence of large amounts of unresolved overloading, the compiler could
consume unbounded amounts of space and time. This diff fixes this problem.

I tried to avoid having this fix lead to a slowdown; in fact, the last three
changes to typecheck_info.m lead to a slight speedup.

compiler/options.m:
doc/user_guide.texi:
	Add a new option, --typecheck-ambiguity-error-limit. This gives the
	number of type assignments that cause the typechecker to stop
	processing further goals. No such facility existed before.

	Add a new option, --typecheck-ambiguity-warn-limit. This gives the
	number of type assignments that cause the typechecker to emit a
	warning. This generalizes the previous hard-coded value in typecheck.m.

	Move the definitions of some existing options to the right set of
	options.

compiler/typecheck_info.m:
	Add the values of the two new options as fields to the typecheck_info,
	since we will want to look them up often.

	Separate out the error_specs concerned with overloading from the other
	error specs, since we want to be able to have an error about excessive
	overloading to overwrite a warning about excessive overloading
	generated earlier.

	Fix a performance bug: the pred_markers were being looked up in the
	pred_info each time they were asked for, even though they were also
	available directly in a field.

	Move the least frequently accessed fields of the typecheck_info
	into a separate substructure, to reduce amount of allocation required.

	Delete the get and set predicates for the most frequently used fields,
	to avoid the overhead of cross-module calls. These fields are now
	accessed via field access functions.

compiler/typecheck.m:
	Don't typecheck goals if the number of type assignments exceeds
	the error limit.

	Conform to the changes in typecheck_info.m.

compiler/typecheck_errors.m:
	Add a function to generate the new error message.

	Conform to the changes in typecheck_info.m.

tests/invalid/ambiguous_overloading_error.{m,err_exp}:
	Add this new test case. It is a copy of the existing test case
	warnings/ambiguous_overloading, but with more overloading. Old
	compilers consume so much memory on it that they eventually run out
	and crash, but the new compiler generates an error message
	and finishes quickly.

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

tests/warnings/ambiguous_overloading.exp:
	Update the output of this test case to account for the fact that
	the context of the warning is now that of the goal *after* the point
	at which the number of type assignments exceeds 50, not the goal
	*before* this point.
2007-05-14 08:20:17 +00:00