Files
mercury/tests/invalid/func_errors.m
Fergus Henderson 74dfe1af37 New test case to check that we correctly report errors
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.)
1997-08-15 15:46:33 +00:00

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.