Files
mercury/tests/invalid/multimode_syntax.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

54 lines
3.2 KiB
Plaintext

multimode_syntax.m:015: Error: no clauses for function `func0'/0.
multimode_syntax.m:017: Error: clause for predicate `multimode_syntax.::'/2
multimode_syntax.m:017: without corresponding `:- pred' declaration.
multimode_syntax.m:017: In clause for predicate `::'/2:
multimode_syntax.m:017: in argument 1 of clause head:
multimode_syntax.m:017: error: the language construct `='/2 should be used as
multimode_syntax.m:017: a goal, not as an expression.
multimode_syntax.m:017: If you are trying to use a goal as a boolean
multimode_syntax.m:017: function, you should write `if <goal> then yes else
multimode_syntax.m:017: no' instead.
multimode_syntax.m:017: In clause for predicate `::'/2:
multimode_syntax.m:017: in argument 2 of clause head:
multimode_syntax.m:017: error: undefined symbol `out'/0.
multimode_syntax.m:022: In the head of a clause for
multimode_syntax.m:022: function `multimode_syntax.func1'/1:
multimode_syntax.m:022: syntax error: some but not all arguments have mode
multimode_syntax.m:022: annotations.
multimode_syntax.m:023: In the head of a clause for
multimode_syntax.m:023: function `multimode_syntax.func1'/1:
multimode_syntax.m:023: syntax error: some but not all arguments have mode
multimode_syntax.m:023: annotations.
multimode_syntax.m:029: In clause for function `func2'/2:
multimode_syntax.m:029: error: mode annotation specifies undeclared mode
multimode_syntax.m:029: `func2(in, out) = out'.
multimode_syntax.m:029: The declared mode for this function is:
multimode_syntax.m:029: :- mode func2(in, in) = out is det.
multimode_syntax.m:031: In clause for function `func2'/2:
multimode_syntax.m:031: error: mode annotation specifies undeclared mode
multimode_syntax.m:031: `func2(out, in) = out'.
multimode_syntax.m:031: The declared mode for this function is:
multimode_syntax.m:031: :- mode func2(in, in) = out is det.
multimode_syntax.m:033: In clause for function `func2'/2:
multimode_syntax.m:033: error: mode annotation specifies undeclared mode
multimode_syntax.m:033: `func2(out, out) = out'.
multimode_syntax.m:033: The declared mode for this function is:
multimode_syntax.m:033: :- mode func2(in, in) = out is det.
multimode_syntax.m:037: In clause for function `func2b'/2:
multimode_syntax.m:037: error: mode annotation specifies undeclared mode
multimode_syntax.m:037: `func2b(in, out) = out'.
multimode_syntax.m:037: The declared mode for this function is:
multimode_syntax.m:037: :- mode func2b(in, in) = out is det.
multimode_syntax.m:041: In clause for predicate `pred2b'/2:
multimode_syntax.m:041: error: mode annotation specifies undeclared mode
multimode_syntax.m:041: `pred2b(in, out)'.
multimode_syntax.m:041: (There are no declared modes for this predicate.)
multimode_syntax.m:049: In the head of a clause for
multimode_syntax.m:049: predicate `multimode_syntax.test2'/2:
multimode_syntax.m:049: syntax error: some but not all arguments have mode
multimode_syntax.m:049: annotations.
multimode_syntax.m:051: In the head of a clause for
multimode_syntax.m:051: predicate `multimode_syntax.test2'/2:
multimode_syntax.m:051: syntax error: some but not all arguments have mode
multimode_syntax.m:051: annotations.