Files
mercury/tests/valid/string_format_in_instance.m
Zoltan Somogyi ebc10c087e Add missing imports needed for format predicates (Mantis bug 371).
compiler/module_imports.m:
    Don't just scan a few kinds of items, scan all items that contain
    goals and/or terms. This includes the instance items that caused
    mantis bug 371, as well as some others (promises, mutables, and
    type definitions).

compiler/prog_data.m:
    Delete an out-of-date comment.

tests/valid/string_format_in_instance.m:
    Add the Mantis test case under a meaningful name.

tests/valid/Mmakefile:
    Enable the new test case.
2014-12-23 00:42:42 +11:00

27 lines
472 B
Mathematica

% vim: ft=mercury ts=4 sts=4 sw=4 et
%
% This is a regression test for Mantis bug #371.
:- module string_format_in_instance.
:- interface.
:- import_module list.
:- type foo
---> foo(int).
:- typeclass cons(T) where [
pred cons(T::in, list(string)::in, list(string)::out) is det
].
:- instance cons(foo).
:- implementation.
:- import_module string.
:- instance cons(foo) where [
cons(foo(X), A, [S | A]) :-
string.format("%d", [i(X)], S)
].