Files
mercury/tests/invalid/predmode.err_exp
Zoltan Somogyi 41b97d2048 Generate better error messages for bad insts and modes.
compiler/parse_inst_mode_name.m:
    When trying to parse an inst or mode name and failing, we used to just
    print the whole term (including the correct parts) and a message about
    the mode being invalid. We now print a message for each incorrect *part*
    of a term, and make its message specific to the particular problem.

    Rename the predicates that parse insts and modes to include "parse"
    in their names, and make them take the additional arguments needed
    for detailed error reporting.

compiler/parse_sym_name.m:
    Put the arguments of a utility predicate in a more sensible order.

compiler/add_clause.m:
compiler/parse_class.m:
compiler/parse_inst_mode_defn.m:
compiler/parse_item.m:
compiler/parse_mutable.m:
compiler/parse_pragma.m:
compiler/parse_tree_out.m:
compiler/parse_type_defn.m:
compiler/parse_type_name.m:
compiler/parse_util.m:
compiler/superhomogeneous.m:
    Conform to the changes above. Make some minor improvements.

compiler/hlds_out_util.m:
    Add a utility predicate for use by the code above.

    Avoid throwing an unnecessary exception.

tests/invalid/combined_ho_type_inst.err_exp:
tests/invalid/impl_def_literal_syntax.err_exp:
tests/invalid/inst_list_dup.err_exp:
tests/invalid/multimode_dcg.err_exp:
tests/invalid/multimode_syntax.err_exp:
tests/invalid/predmode.err_exp:
tests/invalid/with_type.err_exp:
    Expect the improved error messages.
2016-04-26 14:50:18 +10:00

11 lines
625 B
Plaintext

predmode.m:009: Error: some but not all arguments have modes.
predmode.m:009: The argument without a mode is the second.
predmode.m:017: In `:- pred' declaration: in the first argument:
predmode.m:017: error: `1' is not a type.
predmode.m:017: In `:- pred' declaration: in the first argument:
predmode.m:017: error: an integer such as `2' cannot be a valid mode.
predmode.m:017: In `:- pred' declaration: in the second argument:
predmode.m:017: error: `"bad"' is not a type.
predmode.m:017: In `:- pred' declaration: in the second argument:
predmode.m:017: error: a string such as `"worse"' cannot be a valid mode.