Commit Graph

4 Commits

Author SHA1 Message Date
Zoltan Somogyi
2028df3f20 Fix references to func results in a mode error.
compiler/mode_errors.m:
    If the argument whose instantiation we are complaining about is
    the result of a function, say so.

tests/invalid/mode_error_arg_number.{m,err_exp}:
    Add a test of this message.

tests/invalid/bug117.err_exp:
tests/invalid/coerce_int.err_exp:
tests/invalid/html.err_exp:
tests/invalid/inst_matches_final_bug.err_exp:
    Expect the correct reference to function results in these test cases.
2022-10-01 13:06:20 +10:00
Zoltan Somogyi
60783563cd Don't expand insts in inst names.
compiler/error_msg_inst.m:
    When the first occurrence of a named inst I2 is an argument of another
    named inst I1, do *not* expand I2 there. Instead, expand it one of its
    occurrences in the *expansion* of I1.

    To expand I2 at its *first* occurrence in the expansion of I1,
    change the way to format lists of insts to format the head inst
    before formatting the tail insts.

    Shorten a field name.

tests/invalid/html.err_exp:
    Expect the fix for the "omitted insts" bug above.
2022-02-06 08:29:19 +11:00
Zoltan Somogyi
52c0c52cfd Fix formatting when reporting problem insts.
compiler/error_msg_inst.m:
    Fix a bug that caused the suffix that all paths in two predicates
    were supposed to add at the logical end of the constructed pieces
    (though it could be followed by some punctuation) to *not* be added
    to the constructed pieces on some paths. Since with our current approach,
    the suffix for one inst in a list of insts can be the description
    of *all the insts following it in the list*, this bug could delete
    not just punctuation, but entire insts from the output. This did actually
    happen for the invalid/html text case below.

    Fix a problem that could cause each inst in a list of insts
    to be indented one more level than the previous inst, which can be
    very confusing.

    Delete the comma from "instname, which expands to ...". When this output
    occurs in an argument list, the presence of the comma can make it
    harder to recognize where one argument ends and the next argument begins.

    Factor out some common code.

    Add an XXX noting a problem.

    Fix documentation.

compiler/parse_tree_out_inst.m:
    Provide two functions for use by error_msg_inst.m.

compiler/prog_mode.m:
    Fix a comment.

tests/invalid/html.m:
    Fix the description of the problem we are testing for.

tests/invalid/html.err_exp:
    Expect the fix for the "omitted insts" bug above.

tests/invalid/bug117.err_exp:
tests/invalid/bug191.err_exp:
tests/invalid/bug415.err_exp:
tests/invalid/char_inst.err_exp:
tests/invalid/coerce_int.err_exp:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/ho_default_func_4.err_exp:
tests/invalid/merge_ground_any.err_exp:
tests/invalid/polymorphic_unification.err_exp:
    Do not expect the deleted comma.
2022-02-05 19:40:51 +11:00
Zoltan Somogyi
4ebe95672d Don't crash on inst_name nested inside itself.
This fixes Mantis bug #528.

compiler/error_msg_inst.m:
    Since an inst_name IN may be used nested inside itself, as in
    IN(..., IN(...), ...), do not insist that both occurrences of IN
    in such cases lead to the insertion of a new entry in the inst name
    expansion map.

tests/invalid/html.{m,err_exp}:
    The Mantis test case.

tests/invalid/Mmakefile:
    Enable the Mantis test case.
2021-01-30 01:45:26 +11:00