mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-21 20:33:55 +00:00
Bug 264, which this workaround was for, has been fixed in other changes.
compiler/mode_errors.m:
Remove the temporary error.
compiler/modecheck_unify.m:
Don't check this error condition.
doc/reference_manual.texi:
Document the constraint that actually applies, namely that functions
that do not match the default mode do not match Mercury's 'ground'
inst.
Clarify that "no higher-order inst information" means no *explicit*
information. Given that there is a default, this is not the same as
saying there are no logical consequences.
tests/invalid/default_ho_inst.err_exp:
tests/invalid/default_ho_inst_2.err_exp:
Update expected output.
tests/valid/Mmakefile:
tests/valid/ho_func_call_2.m:
New test case. Function modes that are not the same as the default,
but that match it, can still safely be treated as ground.
30 lines
471 B
Mathematica
30 lines
471 B
Mathematica
:- module ho_func_call_2.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- type t ---> a ; b ; c.
|
|
:- inst s ---> a ; b.
|
|
|
|
:- type foo
|
|
---> foo(func(t) = t).
|
|
|
|
:- pred callfoo(foo::in, t::in, t::out) is det.
|
|
|
|
callfoo(foo(F), X, F(X)).
|
|
|
|
:- func subfoo(t::in) = (t::out(s)) is det.
|
|
|
|
subfoo(_) = a.
|
|
|
|
main(!IO) :-
|
|
callfoo(foo(subfoo), c, X),
|
|
io.write(X, !IO),
|
|
io.nl(!IO).
|
|
|
|
% vim: ft=mercury ts=4 sts=4 sw=4 et
|