Files
mercury/tests/valid/intermod_impure.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

26 lines
741 B
Mathematica

% The compiler of 23/8/1999 had a bug which caused a mode error
% if the clauses in a `.opt' file contained a call to an impure predicate.
% The problem was that mode analysis was not reordering the head
% unifications with the impure call because the head unifications
% had been expanded into separate unifications twice - once
% when reading the `.m' file and once when reading the `.opt' file.
% The fix was to avoid putting goals which call impure predicates
% in the `.opt' files.
:- module intermod_impure.
:- interface.
:- import_module io.
:- impure pred main(io__state::di, io__state::uo) is det.
:- implementation.
:- import_module intermod_impure2.
main -->
{ impure intermod_impure(Int) },
io__write_int(Int),
io__nl.