Files
mercury/tests/invalid/multimode_syntax.err_exp
Zoltan Somogyi 0186a64520 Warn for unneeded use of mode-specific clauses.
compiler/add_clause.m:
    Generate a warning for mode-specific clauses when the clause is for
    a predicate that has only one mode, provided that the warning is enabled.

compiler/options.m:
    Add an option to enable this warning.

doc/user_guide.texi:
    Document this option.

library/exception.m:
library/int.m:
library/rtti_implementation.m:
library/string.m:
    Delete modes from clause heads that would get this warning.

tests/valid/spurious_purity_warning.m:
    Delete modes from clause heads that would get this warning.

    Do not interleave predicate definitions.

tests/warnings/unneeded_mode_specific_clause.{m,exp}:
    A test case for this warning.
tests/warnings/Mmakefile:
    Enable the new test case.

tests/invalid/multimode_syntax.err_exp:
    Expect the new warning.
2022-04-13 23:39:23 +10:00

57 lines
3.3 KiB
Plaintext

multimode_syntax.m:015: Error: no clauses for function `func0'/0.
multimode_syntax.m:017: Error: clause for predicate `::'/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:027: Warning: the function `func2'/2 has only one mode, so
multimode_syntax.m:027: there is no need to restrict a clause for it to that
multimode_syntax.m:027: mode.
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.