Files
mercury/tests/invalid/int_ops.err_exp
Zoltan Somogyi 01836315ac Specialize diagnostics for numeric operations.
compiler/typecheck_error_undef.m:
    When users try to use arithmetic operations, bitwise operations,
    or comparisons (meaning functions such as '+' or '<<', or predicates
    such as '<') without importing any of the modules that define those ops,
    generate a diagnostic that explains this specific situation. Mercury
    is unusual in requiring such imports, so novices need to have this
    pointed out to them. Have these messages replace the less-specific
    messages we used to generate in such situations.

    Fix a persistent typo.

tests/invalid/int_ops.{m,err_exp}:
    A new test case for the new diagnostics.

tests/invalid/Mmakefile:
    Enable the new test case.

tests/invalid/multiply_star.err_exp:
    Expect the diagnostic text, and stop expecting the "did you mean"
    message that it replaces.

tests/invalid/multiply_star.err_exp[23]:
    Delete these files. They existed only because different sets of imports
    with different options yielded different "did you mean" suggestions,
    and we don't have those anymore.

tests/invalid/multiply_star.m:
    Update the descriptions of the deleted .err_exp[23] files.
2025-11-02 16:25:59 +11:00

4.1 KiB

int_ops.m:021: In clause for predicate `p'/2:
int_ops.m:021: error: call to undefined predicate `<'/2.
int_ops.m:021: In Mercury, if you want to invoke a numeric comparison
int_ops.m:021: operation such as `<', then you must import a module that
int_ops.m:021: exports that operation. The modules in the Mercury standard
int_ops.m:021: library that do so include `int', `uint', their sized versions
int_ops.m:021: (such as `int8' and `uint16'), as well as `integer' and
int_ops.m:021: `float'. However, none of those modules have
int_ops.m:021: `:- import_module' declarations.
int_ops.m:021: If the values you are trying to compare are not numbers, then
int_ops.m:021: what you probably want is the builtin `@<' operation.
int_ops.m:022: In clause for predicate `p'/2:
int_ops.m:022: error: undefined symbol `<<'/2.
int_ops.m:022: In Mercury, if you want to invoke a bit manipulation operation
int_ops.m:022: such as `<<', then you must import a module that exports that
int_ops.m:022: operation. The modules in the Mercury standard library that do
int_ops.m:022: so include `int', `uint', their sized versions (such as `int8'
int_ops.m:022: and `uint16'), as well as `integer'. However, none of those
int_ops.m:022: modules have `:- import_module' declarations.
int_ops.m:023: In clause for predicate `p'/2:
int_ops.m:023: error: call to undefined predicate `>='/2.
int_ops.m:023: In Mercury, if you want to invoke a numeric comparison
int_ops.m:023: operation such as `>=', then you must import a module that
int_ops.m:023: exports that operation. The modules in the Mercury standard
int_ops.m:023: library that do so include `int', `uint', their sized versions
int_ops.m:023: (such as `int8' and `uint16'), as well as `integer' and
int_ops.m:023: `float'. However, none of those modules have
int_ops.m:023: `:- import_module' declarations.
int_ops.m:023: If the values you are trying to compare are not numbers, then
int_ops.m:023: what you probably want is the builtin `@>=' operation.
int_ops.m:024: In clause for predicate `p'/2:
int_ops.m:024: error: undefined symbol `*'/2.
int_ops.m:024: In Mercury, if you want to invoke an arithmetic operation such
int_ops.m:024: as `*', then you must import a module that exports that
int_ops.m:024: operation. The modules in the Mercury standard library that do
int_ops.m:024: so include `int', `uint', their sized versions (such as `int8'
int_ops.m:024: and `uint16'), as well as `integer' and `float'. However, none
int_ops.m:024: of those modules have `:- import_module' declarations.
int_ops.m:026: In clause for predicate `p'/2:
int_ops.m:026: error: undefined symbol `//'/2.
int_ops.m:026: In Mercury, if you want to invoke an arithmetic operation such
int_ops.m:026: as `//', then you must import a module that exports that
int_ops.m:026: operation. The modules in the Mercury standard library that do
int_ops.m:026: so include `int', `uint', their sized versions (such as `int8'
int_ops.m:026: and `uint16'), as well as `integer'. However, none of those
int_ops.m:026: modules have `:- import_module' declarations.