mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-20 11:54:02 +00:00
Estimated hours taken: 3 Report an error for duplicate mode declarations. compiler/modes.m: Check for duplicate mode declarations. compiler/modecheck_call.m: Add new predicate modes_are_indistinguishable, for use by modes.m. compiler/mode_errors.m: Add predicate report_indistinguishable_mode_error to mode_errors.m, so that modes.m can use it to report duplicate mode declarations. compiler/mode_errors.m: compiler/mercury_to_mercury.m: Move some code in mode_errors.m into a new predicate mercury_output_mode_subdecls/8 in mercury_to_mercury.m. compiler/make_hlds.m: Update a few comments. tests/invalid/Mmakefile: tests/invalid/duplicate_modes.m: tests/invalid/duplicate_modes.err_exp: Test cases for the above change.
35 lines
582 B
Mathematica
35 lines
582 B
Mathematica
:- module duplicate_modes.
|
|
|
|
:- pred p.
|
|
:- mode p is det.
|
|
p.
|
|
|
|
:- pred q(int, int).
|
|
:- mode q(ground -> ground, free -> ground) is det.
|
|
:- mode q(in, out) is det.
|
|
|
|
q(X, X).
|
|
|
|
:- pred r(int, int).
|
|
:- mode r(in, in) is det.
|
|
:- mode r(in, in) is semidet.
|
|
|
|
r(_, _).
|
|
|
|
% this one is legal (albeit not yet supported)
|
|
:- pred s(int, int).
|
|
:- mode s(in, out) is multi.
|
|
:- mode s(in, out) is cc_multi.
|
|
|
|
s(_, 42).
|
|
s(_, 43).
|
|
|
|
% this one is legal (albeit not yet supported)
|
|
:- pred t(int, int).
|
|
:- mode t(in(bound(1)), out) is multi.
|
|
:- mode t(in(bound(2)), out) is cc_multi.
|
|
|
|
t(_, 42).
|
|
t(_, 43).
|
|
|