Files
mercury/tests/invalid/overloading.err_exp
Zoltan Somogyi 3fb55722be Print structured terms on one line if they fit.
The compiler's diagnostic outputs often contain terms, representing
either terms in the program, or other entities such as types or modes.
These can be printed either as

    f(a, b)

or as

    f(
        a,
        b
    )

We usually want the former if the term fits on one line, but the latter
if it is too big to fit on one line. The problem is that the code
generating the diagnostic often does not know what fits on one line.

compiler/error_spec.m:
    This diff adds two new format pieces that respectively stand for
    each half of a matched pair of left and right parentheses.
    The idea is that these can be printed

    - either with a newline, and an indent increment, after the left paren,
      and an indent decrement, and a newline, before the right paren,
      and with all newlines being honored between them,
    - or with no newline after the left paren or before the right paren,
      and all newlines between them being replaced by spaces.

compiler/write_error_spec.m:
    Implement the new format pieces, using the one-line format above
    if the term fits in the space available, or the multi-line format
    if it does not.

compiler/error_type_util.m:
    Use the new mechanism to represent the structure of types.

    Delete an old piece of code that had the same objective,
    but was much cruder and less effective.

tests/invalid/actual_expected.err_exp:
tests/invalid/ext_type_bug.err_exp:
tests/invalid/fbnf.err_exp:
tests/invalid/ho_type_arity_bug.err_exp:
tests/invalid/overloading.err_exp:
tests/invalid/type_diff.err_exp:
    Expect more compact representations of the structure of types.

tests/invalid/type_error_ambiguous.err_exp:
    Expect a different ordering of the same information.
    The difference is due to the changed internal representation
    (in terms of format_pieces) of a type.
2022-10-14 19:13:38 +11:00

14 lines
693 B
Plaintext

overloading.m:057: In clause for predicate `p'/4:
overloading.m:057: in unification of variable `OptInfo'
overloading.m:057: and term `opt_info(MustHaveOwnSlot, EverOnStack,
overloading.m:057: CurIntervalId, V_22, Counter1, StartMap0, EndMap0,
overloading.m:057: VarsMap0, SuccMap0)':
overloading.m:057: type error in argument of functor `opt_info'/9.
overloading.m:057: Argument 3 (CurIntervalId) has type
overloading.m:057: overloading.interval_id,
overloading.m:057: expected type was
overloading.m:057: tree234.tree234(
overloading.m:057: term.var(term.generic),
overloading.m:057: tree234.tree234(overloading.goal_path, string)
overloading.m:057: ).