mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 02:43:40 +00:00
Estimated hours taken: 0.25 tests/invalid/Mmake: tests/invalid/func_errors.m: tests/invalid/func_errors.err_exp: New test case to check that we correctly report errors for certain invalid function declarations. (Mercury 0.6 failed this test case.)
33 lines
701 B
Mathematica
33 lines
701 B
Mathematica
:- module func_errors.
|
|
|
|
:- interface.
|
|
:- import_module int.
|
|
|
|
% it is an error to declare determinism but not modes,
|
|
% or to only declare some of the modes
|
|
|
|
:- func foo(int, int) = int is semidet.
|
|
:- func bar(int::in, int) = int is semidet.
|
|
:- func baz(int::in, int::in) = int is semidet.
|
|
:- func quux(int, int) = (int::out) is semidet.
|
|
|
|
:- func ok(int::in, int::in) = (int::out) is semidet.
|
|
|
|
:- pred p(int, int) is semidet.
|
|
:- mode p(in, in) is semidet.
|
|
:- pred q(int::in, int) is semidet.
|
|
|
|
:- implementation.
|
|
|
|
% foo(X, Y) = X + Y :- X > 0.
|
|
% bar(X, Y) = X + Y :- X > 0.
|
|
% baz(X, Y) = X + Y :- X > 0.
|
|
% quux(X, Y) = X + Y :- X > 0.
|
|
|
|
p(X, Y) :- X > Y.
|
|
% q(X, Y) :- X > Y.
|
|
|
|
ok(X, Y) = X + Y :- X > 0.
|
|
|
|
|