Files
mercury/tests/valid/intermod_dcg_bug2.m
Simon Taylor f89c62ad40 Append the variable numbers to variables in the clauses
Estimated hours taken: 0.5

compiler/intermod.m:
	Append the variable numbers to variables in the clauses
	written to `.opt' files. This fixes a bug which caused
	type errors to be reported for predicates in a `.opt' file.
	The problem was that the names of the DCG variables inside
	a DCG pred expression clashed with the DCG variables of
	the enclosing clause.

tests/valid/Mmakefile:
tests/valid/intermod_dcg_bug.m:
tests/valid/intermod_dcg_bug2.m:
	Test case.
2000-08-04 23:58:49 +00:00

28 lines
428 B
Mathematica

:- module intermod_dcg_bug2.
:- interface.
:- import_module io.
:- pred foo(io__state, io__state).
:- mode foo(di, uo) is det.
:- implementation.
:- import_module int, list.
:- pragma inline(foo/2).
foo -->
{ list__foldl(
(pred(_::in, di, uo) is det -->
=(Var0),
:=(Var0 + 1)
), [1, 2, 3], 0, Count) },
io__write_int(Count),
list__foldl(
(pred(X::in, di, uo) is det -->
io__write(X)
), [1, 2, 3]).