Files
mercury/tests/invalid/default_ho_inst_2.m
Mark Brown 4b640dd74d Fix default func modes in the inst merge operation
compiler/inst_util.m:
    When merging bound with ground, ensure that all functions in the
    bound match the default function mode.

tests/invalid/Mmakefile:
tests/invalid/default_ho_inst_2.{m,err_exp}:
    Test case for this bug. This test currently passes due to the
    workaround for bug 264; the above fix means that the workaround
    is not needed in this case.
2015-11-22 16:51:22 +11:00

40 lines
649 B
Mathematica

:- module default_ho_inst_2.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is cc_multi.
:- implementation.
:- type foo
---> foo(func(string) = string).
:- pred makefoo(foo::out) is det.
makefoo(foo(detfoo)).
:- pred callfoo(foo::in, string::in, string::out) is det.
callfoo(foo(F), X, F(X)).
:- func detfoo(string) = string.
detfoo(X) = X.
:- func semifoo(string::in) = (string::out) is semidet.
semifoo(X) = X :- semidet_true.
main(!IO) :-
(
F = foo(semifoo)
;
makefoo(F)
),
callfoo(F, "X", X),
io.write_string(X, !IO),
io.nl(!IO).
% vim: ft=mercury ts=4 sts=4 sw=4 et