mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-25 06:14:18 +00:00
These test cases were not enabled before due to problems with the mode
checker, since fixed in commit 491bb0ab5f
and thereabouts.
tests/invalid/Mmakefile:
Enable ho_default_func_4 and inst_matches_final_bug.
tests/invalid/ho_default_func_4.m:
Update module import.
tests/invalid/ho_default_func_4.err_exp:
tests/invalid/inst_matches_final_bug.err_exp:
Add expected outputs.
41 lines
833 B
Mathematica
41 lines
833 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% Compiling this module should generate an error message since
|
|
% it tries to cast a non-standard func inst to ground.
|
|
|
|
:- module ho_default_func_4.
|
|
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io__state, io__state).
|
|
:- mode main(di, uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module int.
|
|
:- import_module univ.
|
|
|
|
:- inst one == bound(1).
|
|
|
|
main -->
|
|
{ baz(foo, F) },
|
|
io__write_int(F(42)), nl.
|
|
|
|
:- func foo(int) = int.
|
|
foo(X) = X + 1.
|
|
|
|
:- func bar(int) = int.
|
|
:- mode bar(in(one)) = out is det.
|
|
bar(X) = X.
|
|
|
|
:- pred baz(T::in, T::out) is det.
|
|
baz(X, Y) :-
|
|
( univ_to_type(univ(bar), Y0) ->
|
|
Y = Y0
|
|
;
|
|
Y = X
|
|
).
|