Files
mercury/tests/valid/intermod_impure2.m
Simon Taylor b49cacdb71 Don't write the clauses for predicates which call impure predicates
Estimated hours taken: 1

compiler/intermod.m:
	Don't write the clauses for predicates which call impure predicates
	to `.opt' files. This avoids mode errors when mode checking
	the clauses from `.opt' files. The errors occur because the
	head unifications in clauses read from `.opt' files have been
	expanded twice - once when read from the `.m' file and again when
	read from the `.opt' file. Only the original head unifications may
	be reordered with impure goals. Fixing this in mode analysis would
	be tricky.
	Compilation of the browser directory fails without this change.

	Don't write items to the `.opt' file which were needed only by
	clauses which were traversed but not written out.

tests/valid/Mmakefile:
tests/valid/intermod_impure.m:
tests/valid/intermod_impure2.m:
	Test case.
1999-08-25 06:11:19 +00:00

25 lines
428 B
Mathematica

% See intermod_impure.m.
:- module intermod_impure2.
:- interface.
:- impure pred intermod_impure(int::out) is det.
:- implementation.
intermod_impure(Int) :-
impure intermod_impure_2(Int).
:- impure pred intermod_impure_2(int::out) is det.
:- pragma c_header_code(
"
#include <stdio.h>
").
:- pragma c_code(intermod_impure_2(Int::out), will_not_call_mercury,
"
printf(""Output from impure predicate\\n"");
Int = 2;
").