Files
mercury/tests/invalid/impure_method_impl.err_exp
Simon Taylor a3819d359c Fix the handling of purity in the optimization and tabling passes.
Estimated hours taken: 15
Branches: main

Fix the handling of purity in the optimization and tabling passes.
Without this change tests/tabling/unused_args.m fails with
inter-module optimization.

compiler/purity.m:
compiler/post_typecheck.m:
	Allow purity checking to be rerun on a single procedure
	without requiring an io__state. If the purity is worse
	(due to inlining a predicate with a `:- pragma promise_pure'
	declaration), add `promised_pure' or `promised_semipure'
	to the pred_info.

compiler/hlds_out.m:
compiler/hlds_pred.m:
compiler/intermod.m:
compiler/make_hlds.m:
compiler/mercury_to_mercury.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/prog_data.m:
compiler/prog_io_pragma.m:
compiler/purity.m:
doc/reference_manual.texi:
NEWS:
	Implement `:- pragma promise_semipure'. This is needed if
	an predicate marked `promised_pure' which calls impure
	predicates is inlined into  a semipure predicate.

compiler/inlining.m:
	Make sure the purity markers on the goal_infos are correct
	after inlining predicates which are promised pure.

	Export a predicate inlining__can_inline_proc which is used
	by deforestation to determine whether inlining a procedure
	will change the semantics or will break code generator invariants.

compiler/deforest.m:
	Use the same method as inlining.m to work out whether
	a procedure can be inlined. Don't inline predicates which
	are promised pure because the extra impurity which
	will be propagated through the goal will stop deforestation
	working on the goal.

compiler/simplify.m:
	Make sure the goal_info resulting from converting a singleton
	switch into a conjunction has the correct purity.

compiler/table_gen.m:
	Make sure the purity markers on the generated goal_infos are
	correct.

	Make sure that call_table_gen goal features cannot be removed
	by optimization passes.

	Don't put unnecessary `impure' markers on calls to error/1.

tests/debugger/loopcheck.exp:
tests/debugger/retry.exp:
	Adjust the expected output. The change to ensure that
	`call_table_gen' goal features can't be removed alters
	the goal paths slightly.

tests/invalid/impure_method_impl.m:
	Adjust the expected output now that predicates can
	be promised semipure.
2001-03-27 05:23:23 +00:00

12 lines
807 B
Plaintext

impure_method_impl.m:017: In call to impure predicate `impure_method_impl:foo_m2/2':
impure_method_impl.m:017: purity error: call must be preceded by `impure' indicator.
impure_method_impl.m:017: In type class method implementation:
impure_method_impl.m:017: purity error: predicate is impure.
impure_method_impl.m:017: It must be declared `impure' or promised semipure.
impure_method_impl.m:016: In call to semipure predicate `impure_method_impl:foo_m1/2':
impure_method_impl.m:016: purity error: call must be preceded by `semipure' indicator.
impure_method_impl.m:016: In type class method implementation:
impure_method_impl.m:016: purity error: predicate is semipure.
impure_method_impl.m:016: It must be declared `semipure' or promised pure.
For more information, try recompiling with `-E'.