Commit Graph

4 Commits

Author SHA1 Message Date
Fergus Henderson
3018d7abb2 Perform some minor simplifications in mode analysis,
Estimated hours taken: 1.5

Perform some minor simplifications in mode analysis,
so as to provide more information to unique mode analysis.
Previously unique_modes.m was reporting spurious errors
for tests/hard_coded/bidirectional.m, because modes.m
produced output containing a subgoal of the form
`disj([Goal, conj([disj([])]])' instead of just `Goal',
and the presence of a disjunction then caused unique mode
analysis to make overly conservative assumptions.

compiler/modes.m:
	Ensure that we do not produce singleton conjunctions or disjunctions.
	Also, if the result of mode checking a disjunct is a (nested)
	disjunction, then merge it with the containing disjunction.
	If the nested disjunction is the empty disjunction (fail),
	then this means it will be deleted.

tests/hard_coded/Mmakefile:
	Re-enable the test case bidirectional.m, since the compiler now
	accepts it, due to the above change.

tests/warnings/simple_code.m:
tests/warnings/simple_code.exp:
	Update this test case, because the above change meant that the
	compiler no longer issues the warning about "this disjunct can
	never succeed" in cases like this -- mode analysis will already
	have optimized it away, before we even get to simplify.m (which
	handles those kinds of warnings).  This warning is not as
	important as allowing bidirectional code.
1999-04-16 08:08:08 +00:00
Simon Taylor
f2458bd34b Fix a bug reported by Philip Dart where "this disjunct cannot succeed"
Estimated hours taken: 2

Fix a bug reported by Philip Dart where "this disjunct cannot succeed"
warnings for predicates using sub-typing in modes were being output
without a context.

compiler/hlds_goal.m
	Add versions of true_goal and fail_goal which take
	a context for the goal.

compiler/simplify.m
	Pass a valid context to true_goal and fail_goal.
	Only report most of the --warn-simple-code messages if they
	occur for all modes of a predicate - this avoids spurious
	"this disjunct cannot succeed" warnings for sub-typing.

compiler/det_report.m
	Added det_report__is_any_mode_msg to return whether a
	message should only be reported if it occurs for all modes
	of a predicate.

compiler/passes_aux.m
	Add a task type update_pred_error for use by simplify.m.
1998-06-17 05:14:15 +00:00
Tyson Dowd
cbcb23d17b Enable --warn-interface-imports by default.
Estimated hours taken: 3

Enable --warn-interface-imports by default. This was turned off while
list and term were defined in mercury_builtin.m, since it caused many
warnings.

Fix all the unused interface imports that have been added since then.

compiler/options.m:
	Enable --warn-interface-imports by default.

compiler/module_qual.m:
	Fix formatting inconsistencies with module names in warning
	messages. (".m" was not appended to module names if there was
	only one module).

compiler/*.m:
library/*.m:
tests/invalid/type_loop.m:
tests/warnings/*.m:
	Remove usused interface imports, or move them into
	implementation (mostly bool, list and std_util).
1997-05-21 02:16:53 +00:00
Simon Taylor
3a8d2f4ca9 Test cases for the --warn-simple-code warnings.
Estimated hours taken: 0.2

tests/warnings/simple_code.{m,exp}
	Test cases for the --warn-simple-code warnings.
1997-04-28 00:05:26 +00:00