Files
mercury/tests/invalid/nullary_ho_func_error.m
Zoltan Somogyi 3dc4babb24 Update the style of more test cases.
And update expected output files for changes in line numbers.
2021-07-27 13:29:46 +10:00

32 lines
787 B
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
%
% Test case for use of zero-arity higher-order function terms.
%
% Author: fjh
:- module nullary_ho_func_error.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- func pi = float.
pi = 3.14159.
main(!IO) :-
io.print("apply_nullary_func(pi) = ", !IO),
% this would be legal:
% print(apply_nullary_func((func) = pi)), nl.
% this one is not:
io.print_line(apply_nullary_func(pi), !IO).
:- func apply_nullary_func((func) = T) = T.
:- mode apply_nullary_func(in((func) = out is det)) = out is det.
apply_nullary_func(F) = apply(F).