mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-21 20:33:55 +00:00
We inadventently wrote out 'coerce' casts in .opt files as:
V_2 = 'coerce expression'(V_3).
In commit 233874403f, cast_type_to_string
was changed to return "coerce expression" instead of simply "coerce"
for a slight improvement in mode errors.
compiler/hlds_out_goal.m:
Don't use the result of cast_type_to_string when when writing out
coerce casts.
tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/hard_coded/coerce_opt.exp:
tests/hard_coded/coerce_opt.m:
tests/hard_coded/coerce_opt_2.m:
Add test case.
22 lines
526 B
Mathematica
22 lines
526 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module coerce_opt_2.
|
|
:- interface.
|
|
|
|
:- import_module list.
|
|
|
|
:- type non_empty_list(T) =< list(T)
|
|
---> [T | list(T)].
|
|
|
|
:- func to_list(non_empty_list(T)) = list(T).
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- pragma inline(func(to_list/1)).
|
|
|
|
to_list(Xs) = coerce(Xs).
|