Files
mercury/tests/term/exception_analysis_test.trans_opt_exp
Zoltan Somogyi 66873a528a Fix the handling of status in add_pragma.m.
compiler/add_pragma.m:
    The status checks in this module used to check for only one
    of the four possible combinations of <is pragma exported, is the
    pred the pragma is for expored>, even though we may want to generate
    errors or warnings in three of those combinations. Fix this.

    If an ambiguous pragma applies to more than one predicate, handle
    the status checks of each separately.

    When adding fact table pragmas to the HLDS, replace several lines
    of code that reuse an existing largish predicate with the single line
    of code from that predicate that we actually need.

    Stop representing the statuses of pragmas using the pred_status type,
    since the item_mercury_status that all items come with is adequate
    for all our needs, and is impossible to confuse with the status
    of the pred_info they refer to.

library/exception.m:
library/require.m:
    Move termination pragmas for exported predicates and functions
    from the implementation section to the interface section. This
    avoids a warning that we now generate in such situations.

tests/term/exception_analysis_test.trans_opt_exp:
tests/term/exception_analysis_test2.trans_opt_exp:
    Expected improved termination analysis results now that we export
    termination pragmas that used to be kept private.

tests/warnings/foreign_term_invalid.{m,exp}:
    Avoid warnings about keeping decl pragmas about exported predicates
    private by moving them into the interface.

    Fix the formatting of the top-of-module comment.

    Expect updated line numbers.

tests/warnings/pragma_term_conflict.{m,exp}:
    Don't avoid a warning about keeping decl pragmas about exported predicates
    private. Instead, document it as an additional purpose of this test.

    Expect both the extra warning and updated line numbers.

tests/invalid/pragma_export.{m,err_exp}:
    A new test case for testing the error message for inappropriately
    exported pragmas.

tests/invalid/Mmakefile:
    Enable the new test case.
2022-09-24 19:12:18 +10:00

26 lines
2.5 KiB
Plaintext

:- module exception_analysis_test.
:- pragma termination_info(exception_analysis_test.mutual_test1((builtin.in), (builtin.in)), finite(0, [no, no, no]), can_loop).
:- pragma termination_info(exception_analysis_test.mutual_test2((builtin.in), (builtin.in)), finite(0, [no, no]), can_loop).
:- pragma termination_info(exception_analysis_test.test1((builtin.in)), finite(0, [no, no]), can_loop).
:- pragma termination_info(exception_analysis_test.test2((builtin.in), (builtin.in)), finite(0, [no, no, no]), can_loop).
:- pragma termination_info(exception_analysis_test.test3((builtin.in), (builtin.in)), finite(0, [no, no, no]), can_loop).
:- pragma termination_info(exception_analysis_test.test4((builtin.in), (builtin.in)), finite(0, [no, no, no]), can_loop).
:- pragma termination_info(exception_analysis_test.wrap_equals((builtin.in), (builtin.in)), infinite, cannot_loop).
:- pragma termination2_info(exception_analysis_test.mutual_test1((builtin.in), (builtin.in)), constraints([]), not_set, can_loop).
:- pragma termination2_info(exception_analysis_test.mutual_test2((builtin.in), (builtin.in)), constraints([]), not_set, can_loop).
:- pragma termination2_info(exception_analysis_test.test1((builtin.in)), constraints([]), not_set, can_loop).
:- pragma termination2_info(exception_analysis_test.test2((builtin.in), (builtin.in)), constraints([eq([term(1, r(1, 1)), term(2, r(-1, 1))], r(0, 1))]), not_set, can_loop).
:- pragma termination2_info(exception_analysis_test.test3((builtin.in), (builtin.in)), constraints([eq([term(1, r(1, 1)), term(2, r(-1, 1))], r(0, 1))]), not_set, can_loop).
:- pragma termination2_info(exception_analysis_test.test4((builtin.in), (builtin.in)), constraints([eq([term(1, r(1, 1)), term(2, r(-1, 1))], r(0, 1))]), not_set, can_loop).
:- pragma termination2_info(exception_analysis_test.wrap_equals((builtin.in), (builtin.in)), constraints([]), not_set, cannot_loop).
:- pragma exceptions(predicate, (exception_analysis_test.mutual_test1), 2, 0, conditional).
:- pragma exceptions(predicate, (exception_analysis_test.mutual_test2), 2, 0, conditional).
:- pragma exceptions(predicate, (exception_analysis_test.test1), 1, 0, will_not_throw).
:- pragma exceptions(predicate, (exception_analysis_test.test2), 2, 0, may_throw(type_exception)).
:- pragma exceptions(predicate, (exception_analysis_test.test3), 2, 0, conditional).
:- pragma exceptions(predicate, (exception_analysis_test.test4), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (exception_analysis_test.wrap_equals), 2, 0, may_throw(user_exception)).