mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-05-01 09:14:08 +00:00
Estimated hours taken: 1 Branches: main, release Fix a bug in string.string reported by Peter Ross. library/string.m: Bugfix: previously string.value_to_revstrings was not calling univ_value on arguments of functors that are handled specially. This caused spurious "univ_cons" functors to appear in the string representations of some terms. test/hard_coded/string_string.exp: test/hard_coded/string_string.m: Extended the test case for string.string to cover Peter's example.
38 lines
1.1 KiB
Mathematica
38 lines
1.1 KiB
Mathematica
%-----------------------------------------------------------------------------%
|
|
% string_string.m
|
|
% Ralph Becket <rafe@cs.mu.oz.au>
|
|
% Tue Oct 5 13:10:27 EST 2004
|
|
% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
|
|
%
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- module string_string.
|
|
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
|
|
|
|
:- pred main(io :: di, io :: uo) is det.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- import_module string, list, std_util.
|
|
|
|
:- type tree ---> leaf; branch(tree, tree).
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
main(!IO) :-
|
|
io.write_string(string.string(leaf) ++ "\n", !IO),
|
|
io.write_string(string.string(branch(leaf, leaf)) ++ "\n", !IO),
|
|
io.write_string(string.string([1,2,3]) ++ "\n", !IO),
|
|
io.write_string(string.string(1.234 - 5) ++ "\n", !IO).
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
%-----------------------------------------------------------------------------%
|