Files
mercury/tests/invalid/ho_default_func_4.m
Peter Wang 287eb3bb12 Enable two test cases for checking final insts.
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.
2015-02-20 15:13:02 +11:00

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
).