I seem to have been broken it on Aug 18 with the move to associate
a option with every severity_informational spec. The code added then
treated all these options as bool options, but one is not.
compiler/error_util.m:
Allow a severity_informational spec to depend on an accumulating
option, which --show-pred-movability is.
As far as I can see, it is the only non-bool option used
in such messages, but since we don't have a database of
options named in severity_informational specs, I can't be sure.
compiler/hlds_call_tree.m:
Avoid printing a sentence when its subject is moot.
tests/valid/show_movability.m:
New test case to test the --show-pred-movability option.
tests/valid/Mercury.options:
Specify the option for the new test case.
compiler/foreign.m:
When returning the list of identifiers inside a foreign_proc's code,
ignore the contents of comments. This means that warnings about
variable names that occur in the foreign_proc's argument list
but do not occur in the foreign_proc's code cannot be shut up anymore
by mention the variable name in comments.
The "mostly" part is that typecheck.m still looks at the bodies
of foreign_procs without knowing about comments. Fixing that
will be part a future change.
NEWS.md:
Announce this breaking change.
compiler/fact_table_gen.m:
When we try to generate a foreign_proc's body for a fact table
but cannot do so due to the fact table file not being readable,
add a marker to the predicate that the fact table is for.
compiler/hlds_markers.m:
Update the documentation of the existing predicate marker
we use for this.
compiler/make_hlds_warn.m:
Do not warn about singleton variables in foreign_proc bodies
that are empty due to missing fact table files.
library/array.m:
library/io.file.m:
library/profiling_builtin.m:
library/stm_builtin.m:
library/table_builtin.m:
library/term_size_prof_builtin.m:
tests/invalid/erroneous_throw_promise.m:
tests/invalid/foreign_procs_exist_type.m:
tests/invalid/foreign_purity_mismatch.m:
tests/invalid/gh72_errors.m:
tests/invalid_purity/purity.m:
tests/valid/solv.m:
Shut up warnings about singletons in foreign_procs by adding a _ prefix
to the names of the relevant arguments, and delete the comments
that can no longer do that job.
tests/invalid/foreign_purity_mismatch.err_exp:
tests/invalid/gh72_errors.err_exp:
tests/invalid/gh72_errors.err_exp2:
tests/invalid/gh72_errors.err_exp3:
tests/invalid_purity/purity.err_exp:
Expect updated line numbers.
tests/warnings/warn_return.{m,err_exp}:
Extend this test case to test that
- we DO warn about return statements outside comments, but
- we DO NOT warn about return statements inside comments.
compiler/try_expand.m:
As above.
tests/valid/try_inside_lambda.m:
A minimal version of Volker's test case, with English names.
tests/valid/Mmakefile:
Enable the new test case.
compiler/simplify_proc.m:
If a first attempt to analyse and optimize format calls fails
due to insufficient information about format strings and/or values,
then try the whole process again after pushing copies of the format calls,
and the conjuncts that precede them, into the last preceding branched
control structure (disjunction, switch, or if-then-else). This will
fix the problem if each branch does construct known format strings
and/or values, and is harmless if this is not the case.
tests/valid/format_after_switch.m:
A test case for the new capability.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
Enable the new test case.
Fix some aborts that could happen while type- or modechecking type
conversion expressions.
compiler/typecheck_coerce.m:
When building the set of invariant type parameters, handle a
constructor argument that has a type which is an (unexpanded)
equivalence type.
This fixes GitHub issue #137.
compiler/modecheck_coerce.m:
In modecheck_coerce_from_ground_make_inst_for_subtype,
handle a non-du or tuple type instead of aborting.
In get_ctor_arg_types_do_subst, handle a tuple type
instead of failing (leading to an abort).
tests/invalid/Mmakefile:
tests/invalid/coerce_typecheck_eqv.err_exp:
tests/invalid/coerce_typecheck_eqv.m:
tests/invalid/coerce_typecheck_eqv_helper_1.m:
Add test case.
tests/valid/Mmakefile:
tests/valid/coerce_modecheck_eqv.err_exp:
tests/valid/coerce_modecheck_eqv.m:
tests/valid/coerce_modecheck_eqv_helper_1.m:
Add test case.
tests/valid/gh137.m:
tests/valid/gh137_helper_1.m:
Delete original test case for GitHub issue #137,
as it is subsumed by tests/invalid/coerce_typecheck_eqv.m
NEWS.md:
Add news item for this, and previous changes.
tests/hard_coded/Mercury.options:
tests/valid/Mercury.options:
Delete left-over references.
Break up too-long lines.
tests/valid/mutual_tailrec_outputs.m:
Document that the option that this test case tests is deleted.
compiler/write_deps_file.m:
When trying to check for the existence of .opt files, whether alone
or together with .trans_opt files, do not consider a .m file as
an acceptable substitute. Delete the option that can ask for this
behavior.
compiler/globals.m:
Delete ie_src as a kind of search for source files, since the change
to write_deps_file.m deletes its only use.
compiler/generate_dep_d_files.m:
compiler/handle_options.m:
Conform to the changes above.
tests/term/existential_error1.trans_opt_exp:
Update the expected output of this test case, because the change
in write_deps_file.m causes the compiler to get a library predicate's
termination info from a .opt file instead of a .trans_opt file,
and it happens to be different
tests/term/existential_error1.m:
Document the reason for this difference.
tests/valid/Mmake.valid.common:
tests/warnings/Mmakefile:
The valid_seq/opt_det_warn and warnings/inst_with_no_type test cases
both specify --intermodule-optimization. Before this diff, the .opt file
did not get built, but this was not an issue for the following reasons.
- opt_det_warn tests for the *absence* of any message about something
in the .opt file, while inst_with_no_type tests for a type definition
in the implementation section of the helper module being invisible
outside its module. Both tests are much easier to pass if you do not
actually read the .opt file.
- The generation of the warning message about the .opt file not being
available was suppressed by the fact that the helper module's *source*
file *was* available.
Since the compiler now generates this warning message, so add
mmake rules to force the helper modules' .opt files to be built
before the compilation of the main modules.
tests/valid_seq/Mmakefile:
Define some mmake vars that looked like they should help with
those additional rules, but it seems, they don't.
Add an XXX about a possible problem.
Delete an XXX that is no longer relevant.
Delete a commented out duplicate of an mmakefile entry.
... in the remaining test case directories.
tests/hard_coded/write_reg_1.exp[2345]:
Rename these files to complete the update to the hard_coded test dir.
tests/invalid/Mmakefile:
tests/invalid/coerce_mode_error_1.err_exp:
tests/invalid/coerce_mode_error_1.m:
tests/invalid/coerce_mode_error_2.err_exp:
tests/invalid/coerce_mode_error_2.m:
Rename the coerce_mode_error and coerce_mode_error2 test cases
to coerce_mode_error_[12].
tests/tabling/Mercury.options:
tests/tabling/Mmakefile:
tests/tabling/coup_1.exp:
tests/tabling/coup_1.m:
tests/tabling/coup_2.exp:
tests/tabling/coup_2.m:
tests/tabling/coup_3.exp:
tests/tabling/coup_3.m:
tests/tabling/coup_4.exp:
tests/tabling/coup_4.m:
Rename the coup and coup[233] test cases to coup_[1234].
tests/tabling/seq_1.exp:
tests/tabling/seq_1.m:
tests/tabling/seq_2.exp:
tests/tabling/seq_2.m:
tests/tabling/seq_3.exp:
tests/tabling/seq_3.m:
tests/tabling/seq_4.exp:
tests/tabling/seq_4.m:
Rename the seq and seq[233] test cases to seq_[1234].
tests/tabling/tc_memo_1.exp:
tests/tabling/tc_memo_1.m:
tests/tabling/tc_memo_2.exp:
tests/tabling/tc_memo_2.m:
Rename the tc_memo and tc_memo2 test cases to tc_memo_[12].
tests/tabling/tc_minimal_1.exp:
tests/tabling/tc_minimal_1.m:
tests/tabling/tc_minimal_2.exp:
tests/tabling/tc_minimal_2.m:
Rename the tc_minimal and tc_minimal2 test cases to tc_minimal_[12].
tests/trailing/Mercury.options:
tests/trailing/Mmakefile:
tests/trailing/func_trail_test_1.exp:
tests/trailing/func_trail_test_1.m:
Rename the func_trail_test test case to func_trail_test_1,
due to the existence of func_trail_test_2.
tests/trailing/tu_test_1.exp:
tests/trailing/tu_test_1.m:
tests/trailing/tu_test_2.exp:
tests/trailing/tu_test_2.m:
Rename the tu_test[12] test cases to tu_test_[12].
tests/typeclasses/Mercury.options:
Fix an old oversight by updating a previously-changed module name.
tests/typeclasses/Mmakefile:
tests/typeclasses/ground_constraint_1.exp:
tests/typeclasses/ground_constraint_1.m:
Rename the ground_constraint test case to ground_constraint_1,
due to the existence of ground_constraint_2.
tests/typeclasses/inference_test_1.exp:
tests/typeclasses/inference_test_1.m:
Rename the inference_test test case to inference_test_1,
due to the existence of inference_test_2..
tests/typeclasses/superclass_bug_1.exp:
tests/typeclasses/superclass_bug_1.m:
tests/typeclasses/superclass_bug_2.exp:
tests/typeclasses/superclass_bug_2.m:
tests/typeclasses/superclass_bug_3.exp:
tests/typeclasses/superclass_bug_3.m:
Rename the superclass_bug and superclass_bug[23] test cases
to superclass_bug_[123].
tests/typeclasses/typeclass_exist_method_1.exp:
tests/typeclasses/typeclass_exist_method_1.m:
Rename the typeclass_exist_method test case to typeclass_exist_method_1,
due to the existence of typeclass_exist_method_2.
tests/typeclasses/typeclass_order_bug_1.exp:
tests/typeclasses/typeclass_order_bug_1.m:
tests/typeclasses/typeclass_order_bug_2.exp:
tests/typeclasses/typeclass_order_bug_2.m:
tests/typeclasses/typeclass_order_bug_3.exp:
tests/typeclasses/typeclass_order_bug_3.m:
Rename the typeclass_order_bug and typeclass_order_bug[23] test cases
to typeclass_order_bug_[123].
tests/valid/Mercury.options:
Execute the mpj_7 test case with --infer-all, as its source code says
it should be executed.
tests/valid/Mmakefile:
tests/valid/agc_unbound_typevars_1.m:
tests/valid/agc_unbound_typevars_2.m:
Rename the agc_unbound_typevars and agc_unbound_typevars2 test cases
to agc_unbound_typevars_[12].
tests/valid/exists_fundeps_1.m:
Rename the exists_fundeps test case to exists_fundeps_1,
due to the existence of exists_fundeps_[23].
tests/valid/higher_order_1.m:
tests/valid/higher_order_2.m:
tests/valid/higher_order_3.m:
tests/valid/higher_order_4.m:
tests/valid/higher_order_5.m:
Rename the higher_order and higher_order[2345] test cases
to higher_order_[12345].
tests/valid/ho_func_call_1.m:
Rename the ho_func_call test case to ho_func_call_1,
due to the existence of ho_func_call_2.
tests/valid/lambda_instmap_bug_1.m:
tests/valid/lambda_instmap_bug_2.m:
Rename the lambda_instmap_bug and lambda_instmap_bug2 test cases
to lambda_instmap_bug_[12].
tests/valid/livevars_shallow_1.m:
tests/valid/livevars_shallow_2.m:
Rename the livevars_shallow and livevars_shallow2 test cases
to livevars_shallow_[12].
tests/valid/mpj_2.m:
tests/valid/mpj_5.m:
tests/valid/mpj_6.m:
tests/valid/mpj_7.m:
Rename the mpj_[2567] test cases to mpj_[2567].
tests/valid/multidet_prune.m:
Rename the multidet_prune1 test case to multidet_prune,
since there is no other multidet_prune* test case.
tests/valid/record_syntax_bug_1.m:
Rename the record_syntax_bug test case to record_syntax_bug_1
due to the existence of record_syntax_bug_[234].
tests/valid/reuse_static_1.m:
tests/valid/reuse_static_2.m:
Rename the reuse_static and reuse_static2 test cases
to reuse_static_[12].
tests/valid/sharing_loop_1.m:
tests/valid/sharing_loop_2.m:
tests/valid/sharing_loop_3.m:
Rename the sharing_loop and sharing_loop[23] test cases
to sharing_loop_[123].
tests/valid/simplify_bug_1.m:
tests/valid/simplify_bug_2.m:
Rename the simplify_bug and simplify_bug2 test cases
to simplify_bug_[12].
tests/valid/solver_type_bug_1.m:
Rename the solver_type_bug test case to solver_type_bug_1,
due to the existence of solver_type_bug_2.
tests/valid/state_var_mode_bug_1.m:
tests/valid/state_var_mode_bug_2.m:
Rename the state_var_mode_bug and state_var_mode_bug2 test cases
to state_var_mode_bug_[12].
tests/valid/switch_detection_bug_1.m:
tests/valid/switch_detection_bug_2.m:
Rename the switch_detection_bug and switch_detection_bug2 test cases
to switch_detection_bug_[12].
tests/valid/tricky_assert.m:
Rename the tricky_assert2 test case to tricky_assert,
since there is no other tricky_assert* test case.
tests/valid/unused_args_test.m:
Rename the unused_args_test2 test case to unused_args_test,
since there is no other unused_args_test* test case.
tests/valid/new_getopt_io.m:
Keep this proposed new version of getopt_io.m here to prevent
regression while I work on allowing higher order inst info in types
in more places. (Putting it into the library would announce the
new capability prematurely.)
tests/valid/Mmakefile:
Enable the new test case.
compiler/inst_test.m:
Add a type argument to inst_is_ground and related predicates.
Previously, these predicates passed the type variable returned by
the "no_type_available" function, which was less than ideal, because
it prevents the recognition of a bound inst that lists all the function
symbols of the type as being ground (provided of course that all
*their* arguments are themselves ground).
Stop considering "any" to match "ground" if the type is not a solver type.
The previous code did the right thing for invalid/bad_fact_table_decls
*only* because of the absence of type information; the new code does
the right thing by design. (However, valid/any_matches_bound did depend
on the old behavior.)
compiler/add_pragma_tabling.m:
compiler/common.m:
compiler/complexity.m:
compiler/deforest.m:
compiler/delay_construct.m:
compiler/delay_partial_inst.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/fact_table.m:
compiler/goal_mode.m:
compiler/hlds_proc_util.m:
compiler/instmap.m:
compiler/interval.m:
compiler/lco.m:
compiler/loop_inv.m:
compiler/mode_errors.m:
compiler/mode_test.m:
compiler/modecheck_call.m:
compiler/modecheck_coerce.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/modes.m:
compiler/pd_util.m:
compiler/proc_requests.m:
compiler/prog_rep.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_disj.m:
compiler/ssdebug.m:
compiler/table_gen.m:
Conform to the changes in inst_test.m, by passing along either
the actual types of the variables later being tested for groundness,
or the whole var_table in which their type can later be looked up.
tests/valid/Mmakefile:
tests/valid/any_matches_bound.m:
Disable the any_matches_bound test case, because it depends on behavior
that this diff changes. (That behavior was intented to support HAL,
but is now obsolete.)
compiler/inst_mode_type_prop.m:
This module used to check for only one kind of error:
an inst name that was declared as being for a given type_ctor
being applied to a value of a type whose principal type_ctor
is not the declared one. Add tests for other incompatibilities
between the inst and the type it is applied to:
- a cons_id in a bound inst having a module qualifier that is
incompatible with the module qualification of the type_ctor;
- a cons_id in a bound inst not being a data constructor
in the type_ctor;
- a higher order inst being applied to a non-higher-order type, and
- a higher order inst being applied to a higher-order type of the
wrong arity.
To make it possible to generate well-formatted error messages, especially
for the last two kinds of errors, pass around the traversals not just
the module_info, but also the type- and inst-varsets that specify the
names of the type and inst vars in the types and insts. To do this
without excessive argument passing, group all three into a single
structure, and make this structure the fourth type in the main typeclass
of this module.
compiler/types_into_modes.m:
Conform to the changes in inst_mode_type_prop.m.
compiler/error_msg_inst.m:
To make possible the proper formatting of one of the new diagnostics
in inst_mode_type_prop.m, add an extra parameter to the error_msg_inst
function (and to its error_msg_inst_name cousin): the prefix to use when
choosing to format an inst to fit all on one line. For all previous
callers of this function, there was no prefix required, but now there is.
compiler/add_mutable_aux_preds.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_inst_table.m:
compiler/mode_errors.m:
Conform to the change in error_msg_inst.m.
tests/hard_coded/curry.m:
tests/hard_coded/ho_solns.m:
tests/valid/constrained_poly_bound_arg.m:
tests/valid/constrained_poly_insts.m:
Fix code that has been broken all along, we just lacked the diagnostics
to report it :-(
tests/invalid/type_prop_into_inst.{m,err_exp}:
Add a new test case, containing the old, incorrect code in the above
test cases, to test the new diagnostics.
tests/invalid/Mmakefile:
Enable the new test case.
tests/invalid/coerce_recursive_type.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
Expect one of the new diagnostics in addition to the existing ones.
tests/invalid/qualified_cons_id2.err_exp:
Expect one of the new diagnostics in addition to some of existing ones.
Do not expect two old diagnostics. One reported the same problem that
the new diagnostic reports, but in a very confusing way: it reported
that yes(ground) cannot be unified with yes(_), which is nonsense;
the new diagnostic reports the actual problem, which is that the code
tried to apply an inst that specified qualified_cons_id2.yes(...) to
a term of type maybe.yes(...) (i.e. the bug was a disagreement over
module qualification.) The other old diagnostics we don't get anyone
is a consequence of the fact that we now report the bug earlier, and
this makes the compiler stop before determinism analysis.
This fixes Mantis bug #572.
compiler/liveness.m:
As above. The details are described in tests/valid/bug572.m.
compiler/hlds_out_goal.m:
Add a comment to direct readers to what they may be looking for.
tests/valid/bug572.m:
Add the test case for Mantis #572.
tests/valid/Mmakefile:
Enable the new test case.
tests/invalid_nodepend/Mercury.options:
tests/invalid_purity/Mercury.options:
Let several test cases proceed to the compiler invocation we want to test.
tests/submodules/impl_def_literal.m:
Comment out the atomic goal in this test case. (See below for the reason.)
tests/valid/big_foreign_type.m:
tests/valid/bug318.m:
tests/valid/flatten_conj_bug.m:
tests/valid/ho_and_type_spec_bug.m:
tests/valid/mert.m:
tests/valid/param_mode_bug.m:
These test cases were missing C# definitions (and in some cases,
Java definitions) of types and/or predicates. Add them.
tests/warnings/Mercury.options:
tests/warnings/Mmakefile:
Update references to a not-long-ago renamed file.
tests/warnings/foreign_singleton.m:
Add Java and C# definitions of some predicates.
tests/warnings/foreign_singleton.exp:
Update the line numbers in the expected output for C.
tests/warnings/foreign_singleton.exp[23]:
Add these expected output files for Java and C#.
compiler/simplify_goal.m:
Generate an error message if we find an atomic goal
but we are targeting a language which has no definitions
for the primitive operations used in the implementation of such goals.
Until now, for tests/submodules/impl_def_literal.m (which until now
contained an atomic goal), the compiler would generate code that
aborted at runtime. We report the problem, which avoids the generation
of code that would abort.
compiler/call_gen.m:
When a builtin generates an output that the rest of the computation
ignores, don't update the state of the output variable(s), because
the presence of a state for a variable that shouldn't exist
can cause a compiler abort later.
compiler/code_gen.m:
Pass the needed info to call_gen.m.
tests/valid/dead_get_io_state.m:
A new test case for this bug, whose module comment explains
the chain of events leading to the compiler abort.
tests/valid/Mmakefile:
Enable the new test case.
... and make the set of test cases in the valid/valid_seq test directories
easier to handle.
tests/valid_seq/call_impure_in_opt_helper_1.m:
Add a C# definition for a predicate that is defined entirely
by foreign_procs.
tests/valid/Mmake.valid.common:
Note the reason why many of the test cases using this file fail
when executed in C# grades.
Add a target that I used to debug that problem.
Put the descriptions of a set of make variables in lexicographic order,
except for OTHER_PROGS, which has to stay at thee end as it means
"none of the above". Without this reordering, it was not clear that
the cause of the failures was NOT a mistake in the spelling of
one of these variable names.
tests/valid/Mmakefile:
tests/valid_seq/Mmakefile:
Put the definitions of those make variables in the same order.
tests/Mmake.common:
Improve programming style.
The code in make_hlds_warn.m that is intended to generate singleton warnings
hasn't ever been able to handle code containing 'some [...]' goals properly.
The reason is that
- add_clause.m invokes make_hlds_warn.m only *after* it does quantification
on the body of the clause being added to the HLDS, but
- quantification has always replaced all lists of quantified variables
with the empty list.
This meant that
- we never could report code in which the only occurrence of a variable
was in a list of quantified variables, which is something we *should*
warn about, and
- we always did generate a singleton warning for code such as
"some [Val] map.search(Map, Key, Val)", which is something we *should not*
warn about.
This diff fixes this problem.
The main change is a mechanism that allows us to tell quantification.m
to keep lists of quantified variables intact. However, since the rest
of the compiler does not react well to these lists not being empty,
this diff
- gets make_hlds_warn.m to report whether the clause body goal, in which
quantification.m was told to preserve any lists of quantified variables,
*actually contained* any nonempty lists of quantified variables, and
- if it did, then we invoke quantification.m again, this time telling it
to nuke all lists of quantified variables.
This nuking has to be done relatively rarely, because only a very small
fraction of clauses contain any explicit quantification.
(An alternative design would be for make_hlds_warn.m to always nuke
any nonempty list of quantified variables it traversed. However, this would
require *always* rebuilding the clause body goal, which would probably
be slower on average.)
The above is the main change in this diff. However, the change that is
responsible for the bulk of the diff is the addition of a flag to
exist_quant scopes to specify whether that scope was created by the user
or by the compiler. This is needed because if make_hlds_warn.m sees code
such as "some [Val] map.search(Map, Key, Val)", it definitely *should*
generate a warning about Val being singleton (if it does not occur outside
this code) if the "some [Val]" scope was put there by the compiler.
compiler/make_hlds_warn.m:
Treat user-generated exist_quant scopes as before (the old code did
the right thing to generate warnings, it was just given wrong inputs).
Treat compiler-generated exist_quant scopes as if they weren't there,
for warning-generating purposes.
To make this distinction possible, use separate code to handle
exist_quant and promise_solutions scopes.
Record whether the goal traversal has seen any nonempty lists of quantified
variables, and return this info to the caller in add_clause.m.
Encode the nonempty nature of a list in the argument structure of a
predicate.
Update some obsolete terminology in variable and field names.
Clarify the logic of some code.
compiler/quantification.m:
Add the keep_quant/do_not_keep_quant switch described above.
Add some documentation of the predicates to which it is applicable.
Add free_goal_expr_vars, a version of free_goal_vars that takes
only a goal expr, without the goal info. At one point, I thought
this diff needed it. It does not, so the new function is not used,
but there is also not much point in deleting it, Simplify the code
of free_goal_vars, deleting one of its callees after inlining it
at its only call site.
Replace a appended-to-at-the-front-and-then-reversed list with a cord.
compiler/hlds_goal.m:
Add the created-by-user-or-compiler flag to exist_quant scopes.
compiler/add_clause.m:
Move the code that invokes make_hlds_warn.m to warn about singletons
into the clauses_info_add_clause predicate, whose subcontractor
add_clause_transform does the initial quantification. The reason
for this move is that we have never generated singleton variable warnings
for clauses that were read in from .opt files, or for clauses which are
known to have syntax errors. With the new setup, if we such clauses,
clauses_info_add_clause can, and does, tell add_clause_transform
to tell quantification.m to nuke lists of quantified variable
right away. It is only for the clauses we *can* warn about
that clauses_info_add_clause will tell add_clause_transform
to keep those variables, and will then itself invoke the code
in make_hlds_warn.m that warns about singletons, followed, if needed,
by a var-list-nuking reinvocation of quantification.
This centralization of the code relevant to warning code in
clauses_info_add_clause also allows the deletion of several of its
output arguments, since its two callers used those arguments
only to invoke the warning-generation code. It also eliminates
the duplication of code in those two callers.
compiler/instance_method_clauses.m:
Conform to the change in add_clause.m.
compiler/add_foreign_proc.m:
compiler/assertion.m:
compiler/constraint.m:
compiler/cse_detection.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/format_call.m:
compiler/goal_expr_to_goal.m:
compiler/goal_util.m:
compiler/hlds_desc.m:
compiler/hlds_out_goal.m:
compiler/interval.m:
compiler/lambda.m:
compiler/mark_tail_calls.m:
compiler/ml_code_gen.m:
compiler/mode_constraints.m:
compiler/modecheck_goal.m:
compiler/polymorphism_goal.m:
compiler/pre_quantification.m:
compiler/purity.m:
compiler/saved_vars.m:
compiler/simplify_goal_scope.m:
compiler/simplify_proc.m:
compiler/state_var.m:
compiler/stm_expand.m:
compiler/superhomogeneous.m:
compiler/switch_detection.m:
compiler/try_expand.m:
compiler/typecheck.m:
compiler/unique_modes.m:
Conform to the change in hlds_goal.m and/or quantification.m.
compiler/options.m:
Add a way to detect the presence of this fix in the installed compiler.
tests/valid/Mmakefile:
Enable the old test case for this problem, some_singleton,
which we haven't passed until now.
tests/warnings/Mmakefile:
Enable the missing_singleton_warning test case, which we haven't passed
until now.
--no-ansi (mgnuc) and --no-ansi-c (mmc) have not actually done anything for
many years now. Deprecate these options and remove their "use" throughout most
of the Mercury system. (The remaining uses are in the Makefiles for the Boehm
GC, which need to be updated separately.)
Also deprecate the internal compiler option --cflags-for-ansi.
compiler/options.m:
Document that --no-ansi-c is now deprecated.
Document that the internal option --cflags-for-ansi is now
deprecated.
compiler/compile_target_code.m:
Do not pass the ANSI options to the C compiler.
scripts/mgnuc.in:
scripts/mgnuc_file_opts.sh-subr:
Deprecate the --no-ansi option; delete code that no longer does
anything useful.
configure.ac:
Delete the configuration variable CFLAGS_FOR_ANSI; it is only ever
set to be empty. (The comment talks about --no-ansi doing other things
in the mgnuc script. It used to also cause some preprocessor macros
to be defined for compatibility with the system headers on some
platforms -- that has not been the case since 2013.)
doc/user_guide.texi:
Document that --no-ansi-c is deprecated.
bytecode/Mmakefile:
compiler/Mercury.options:
library/Mercury.options:
extras/odbc/odbc.m:
runtime/Mmakefile:
scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
tests/hard_coded/Mercury.options:
tests/valid/Mercury.options:
trace/Mmakefile:
util/Mmakefile:
Conform to the above change.
NEWS.md:
Announce the above.
NEWS:
Mention all the user-visible changes below.
library/enum.m:
Add the typeclass uenum, which is a version of the existing enum typeclass
that maps items to uints, not ints. It also uses a semidet predicate,
not a semidet function, to get back to the item from the uint.
library/sparse_bitset.m:
library/fat_sparse_bitset.m:
Make these modules operate on uints, which means requiring the items
in the sets to be instances of uenum, not enum.
If a few places, improve loops by doing previously-repeated conversions
of [u]ints into <offset, bit-to-set> pairs just once.
library/counter.m:
Define ucounters, which allocate uints. Improve documentation.
library/digraph.m:
Change digraph_keys from ints to uints, since we put them into
sparse_bitsets.
library/int.m:
Make int an instance of the uenum typeclass. This can help users
who currently put ints into sparse_bitsets.
library/pprint.m:
Prettyprint sparse_bitsets as lists of uints.
library/term.m:
Make vars instances of uenum as well as enum.
library/uint.m:
Make uint an instance of the uenum typeclass.
Add the ubits_per_uint function, which allows some casts to be avoided.
compiler/make.deps_set.m:
Change the indexes we put into sparse_bitsets from ints to uints.
compiler/make.make_info.m:
Change the source of those indexes from ints to uints.
compiler/make.top_level.m:
compiler/make.util.m:
Conform to the changes above.
compiler/pre_quantification.m:
Change zones from ints to uints, since we put them into sparse_bitsets.
tests/hard_coded/int_uenum.{m,exp}:
tests/hard_coded/Mmakefile:
Enable the new test case.
tests/valid/use_import_only_for_instance.m:
Update this extract from library/digraph.m the same way as
library/digraph.m itself.
Since the compiler now refuses to allow debugging in parallel grades,
tests that require debugging need to be skipped over in low-level
parallel grades or deleted.
tests/hard_coded/Mmakefile:
Disable 'parse' test in parallel grades as it happens to link with
debug libraries.
tests/par_conj/Mercury.options:
tests/par_conj/Mmakefile:
tests/par_conj/par_ddeath.exp:
tests/par_conj/par_ddeath.m:
tests/par_conj/par_ddeath_2.exp:
tests/par_conj/par_ddeath_2.m:
Delete par_ddeath and par_ddeath_2 tests that once triggered a
compiler abort with --trace deep in parallel grades.
I don't think there is much value in keeping them around.
tests/valid/Mmake.valid.common:
Skip LLDS_PROGS (i.e. test cases that required debugging) in
parallel grades.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/untuple_bug.m:
Delete untuple_bug. It tests an old bug in the untupling
transformation, which was more a programming exercise than something
that should be used anyway.
GCC 12 has new warning, -Winfinite-recursion, that is being triggered by six
tests in the directory tests/valid when compiled in high-level C grades. Since
we also enable -Werror, this is causing these test to fail. Fix these failures
by either removing the infinite recursion from them or by disabling the new GCC
warning for the affected test cases.
configure.ac:
tests/DEFNS_FOR_TESTS.in:
Define a variable whose value is the option for disabling GCC's infinite
recursion check.
tests/valid/higher_order5.m:
tests/valid/stack_alloc.m:
Modify these tests so they do not trigger the infinite recursion warning
in GCC (or Mercury for that matter).
tests/valid/mode_syntax.m:
tests/valid/same_length_2.m:
Merge these two tests (under the first name) since they both test the same
thing. Delete the same_length_2 version.
tests/valid/Mmakefile:
Conform to the above deletion.
tests/valid/Mercury.options:
Include DEFNS_FOR_TESTS here so that mmc --make can see it.
Disable GCC's infinite recursion check for those tests that trigger
it.
Shut up a bunch Mercury warnings for the mode_syntax test case that
are unrelated to what is actually being tested.
compiler/add_clause.m:
Generate a warning for mode-specific clauses when the clause is for
a predicate that has only one mode, provided that the warning is enabled.
compiler/options.m:
Add an option to enable this warning.
doc/user_guide.texi:
Document this option.
library/exception.m:
library/int.m:
library/rtti_implementation.m:
library/string.m:
Delete modes from clause heads that would get this warning.
tests/valid/spurious_purity_warning.m:
Delete modes from clause heads that would get this warning.
Do not interleave predicate definitions.
tests/warnings/unneeded_mode_specific_clause.{m,exp}:
A test case for this warning.
tests/warnings/Mmakefile:
Enable the new test case.
tests/invalid/multimode_syntax.err_exp:
Expect the new warning.
compiler/mercury_compile_front_end.m:
Invoke inst_check.m even when warn_insts_without_matching_type
is not enabled, in order to get both
- the errors it can generate, and
- its canonicalization effect.
The latter fixes Mantis bug #556.
compiler/inst_check.m:
Document the fact that this module canonicalizes references to
char.char to refer to the builtin type representing characters.
Test whether warn_insts_without_matching_type is enabled before
generating warnings for inst definitions without a "for type_ctor" clause
that don't match any types.
Test whether warn_insts_without_matching_type is enabled before
generating errors for inst definitions *with* a "for type_ctor" clause
that do not match their declared type, because the mismatch may be
(and, in the most relevant cases, definitely is) due to a limitation
of the current compiler.
Generate a specific error message when an inst definition says
it is for a user type constructor that is an equivalence type.
compiler/fact_table.m:
Delete a now-obsolete XXX.
tests/invalid/inst_for_eqv_type.{m,err_exp}:
A new test case to show that we report inst definitions that specify
they are for a user-defined equivalence type.
tests/valid/inst_for_char_type.m:
A new test case to show that we *don't* report inst definitions
that specify they are for "char.char".
tests/invalid/Mmakefile:
tests/valid/Mmakefile:
Enable the new test cases.
library/io.m:
As above. They were already marked as obsolete.
NEWS:
Mention the change.
tests/hard_coded/remove_file.m:
tests/hard_coded/utf8_io.m:
tests/par_conj/dep_par_24.m:
tests/par_conj/dep_par_24b.m:
tests/tabling/mercury_java_parser_dead_proc_elim_bug.m:
tests/tabling/mercury_java_parser_dead_proc_elim_bug2.m:
tests/valid/mercury_java_parser_follow_code_bug.m:
Replace references to the deleted predicates.
This fixes Mantis bug #544.
The code of add_trail_ops.m can transform
<code that adds an entry to const_var_map>
into
(
...
<code that adds an entry to const_var_map>
...
;
...,
fail
)
where the const_var_map in the MLDS code generator records which variables'
values are available as ground terms.
The MLDS code generator used to reset the const_var_map in its main data
structure, the ml_gen_info, at the end of every disjunction (actually,
at the end of every branched control structure) to the value it had
at the start. This was intended to prevent the code following the branched
structure from relying on const_var_map entries that were added to the
const_var_map on *some* branches, but not others. However, in this case,
it has the effect of forgetting the entry added by the first disjunct,
even though
- the code after the disjunction can be reached *only* via the first disjunct,
and
- the code after the disjunction (legitimately, until add_trail_ops) depended
on that entry being available.
The fix is to allow the code after a branched control structure to depend
on any const_var_map entry that is present in the final const_var_map
in every branch of the branched control structure whose end is reachable.
The LLDS code generator was not affected by the bug, because it uses
totally separate systems both for implementing trailing, and for keeping
track of what variables' values are available statically. In particular,
it does not rely on operations inserted and the annotations left on
unifications by the add_trail_ops and mark_static_term passes,
having been written long before either module existed.
compiler/hlds_goal.m:
Document the update above to what may be marked static.
compiler/ml_gen_info.m:
Document the updated protocol for handling the const_var_map field.
Use a named type instead of its expansion.
compiler/ml_code_gen.m:
Make the predicates that generate code for a branch in a branched
control structure return the final const_var_maps from the branches
whose endpoints are reachable.
Add a predicate that computes the consensus of all the gathered
const_var_maps.
Compute consensus const_var_maps for if-then-elses and negations.
Fix some inconsistencies in variable naming.
Simplify some code.
compiler/ml_disj_gen.m:
Compute consensus const_var_maps for disjunctions.
compiler/ml_string_switch.m:
compiler/ml_switch_gen.m:
compiler/ml_tag_switch.m:
Compute consensus const_var_maps for various kinds of switches.
In some predicates, put related arguments next to each other.
compiler/ml_unify_gen_construct.m:
Delete "dynamic" from the names of several predicates that also handled
non-dynamic construction unifications.
Fix an out-of-date comment.
compiler/mark_static_terms:
Fix grammar in a comment.
library/map.m:
Fix a careless bug: when doing a merge in map.common_subset_loop,
we threw away an entry from the wrong list in one of three cases.
Make such bugs harder to overlook by
- deleting the common parts from variable names, leaving the differences
easier to see, and
- replacing numeric suffixes for completely separate data structures
with A and B suffixes.
tests/valid/bug544.m:
A new test case for the bug.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
Enable the bug, and run it with -O5.
compiler/parse_item.m:
Add previously missing code for parsing promise_ex declarations
(promise_exclusive, promise_exhaustive, and promise_exclusive_exhaustive)
of the form ":- all [vars] promise_ex... goal."
Comment out the code for parsing another form of such declarations,
":- promise_ex... goal.", which also had missing code and thus
never worked.
Check whether the first argument of a "some" or "all" quantifier
is a list of variables in just one place.
compiler/status.m:
Fix a bug in code that already had an XXX. Without this fix,
the new test case would get a spurious error from check_promise.m.
compiler/check_promise.m:
Fix several instances of another bug uncovered by the fix in status.m.
The problem was that the code that checked promises in the interface
section to see whether they contained any inappropriate references
to predicates or data constructors defined in the implementation section
considered, due to the bug now fixed in status.m, predicates and data
constructors imported from other modules to be defined in the
implementation section of this module. In fact, it did not even consider
the question of whether the predicate or data constructor was defined
in the current module at all.
Fixing this requires making a choice: may promises in the interface
refer to predicates and data constructors defined in other modules,
or not? The language manual does not answer this question, or any
other, about promises, since (a) all its documentation of promise
declarations is commented out, and (b) even the commented-out prose
is silent on references to other modules in promises.
The fix chosen by this diff is to let a promise refer to other modules
only if it is in the implementation section. The reason for this is that
I would find it strange to have module A rely on a promise made by
module B about the properties of e.g. a predicate in module C.
While having the code of module B itself rely on a promise that
module B itself makes about module C is not ideal, at least if the
promise is wrong, the effect of the wrong promise will be local.
(In a review comment, Julien pointed out that having module B make promise
about a predicate in module C may make sense if module C was provided
by an external entity, which may make moving the promise itself
to module C problematic in practice.)
Make error messages clearer via additional punctuation.
compiler/intermod.m:
Make the result of writing out a promise look better.
compiler/parse_tree_out.m:
Make the code writing out promises add a parentheses, without which
we could not read the promise back in.
tests/valid/promise_ex.m:
Add a test case for whether we can parse a promise_ex declaration.
tests/valid/Mmakefile:
Enable the new test case.
tests/invalid/assert_in_interface.err_exp:
Expect the error message we now generate for cross-module promises
in interface sections.
tests/invalid/tricky_assert1.err_exp:
Expect additional punctuation in an error message.
compiler/lco.m:
Do not replace a plain call such as
type_check(E, T)
with
LCMCpr_type_check_1(E, AddrOfT)
which does NOT bind T, if later code in the procedure needs the value of T
in the current stack frame.
This fixes Mantis bug 539.
tests/valid/Mmakefile:
Enable the bug539 test case.
tests/valid/Mercury.options:
Do not force bug539.m to be compiled in asm_fast.gc; the bug
is not grade dependent.
This fixes github bug #98.
compiler/polymorphism.m:
Compiling gh98.m used to cause a compiler crash when the compiler
tried to look up info about a typeclass_info variable that was needed
in a call inside a lambda goal, but was not created inside the lambda goal.
It should therefore have been listed as a nonlocal of the lambda goal,
but it was not, because none of the variables inside the lambda goal
had the typeclass constraint represented by that typeclass_info var
on their types. And since later invocations of quantification may
reduce, but may not expand, the set of nonlocals in a rhs_lambda_goal
(as opposed to the nonlocals set of the unification whose RHS consists
of that rhs_lambda_goal), this problem stuck.
Fix this underestimation of the final lambda nonlocals set by including
in it all typeinfo and/or typeclass_info vars in the updated lambda goal.
Since this may then result in an overestimation, set a flag to force
a requantification of the whole procedure body once its polymorphism
transformation has been completed.
compiler/polymorphism_info.m:
Add a flag to force requantification.
compiler/goal_util.m:
Fix a misleading predicate name.
compiler/hlds_goal.m:
Fix documentation of rhs_lambda_goal.
compiler/hlds_out_goal.m:
Fix a layout problem in HLDS dumps.
compiler/hlds_pred.m:
compiler/lambda.m:
Fix misleading variable names.
tests/valid/gh98.m:
Add the github test case.
tests/valid/Mmakefile:
Enable the new test case.
This is the first step towards implementing a subtypes feature.
It introduces type definitions of the form
:- type subtype =< supertype ---> body.
Later, terms of a subtype should share a data representation with their
supertype, and it will be possible to convert terms between two types
that share "base types" using a coerce operation.
doc/reference_manual.texi:
Add documentation for subtypes.
Add documentation for a proposed `coerce' operation, commented out
for now.
Add "=<" to the list of reserved type names.
compiler/hlds_data.m:
Add supertype field to hlds_du_type.
compiler/prog_data.m:
Add du_supertype field to type_details_du.
Add comment for future work.
compiler/parse_type_defn.m:
Parse subtype definitions.
Check that variables which occur in the "=< supertype" part
also occur on the left hand side of the subtype definition.
compiler/parse_type_name.m:
Add a new context for why_no_ho_inst_info.
Add "=<" to is_known_type_name, i.e. prevent the user from defining
a type of that name (any longer).
compiler/add_type.m:
Rename add_du_ctors_check_foreign_type_for_cur_backend to
add_du_ctors_check_subtype_check_foreign_type.
In add_du_ctors_check_subtype_check_foreign_type, check that
subtype definitions satisfy the conditions documented in the
reference manual.
compiler/make_hlds_passes.m:
Conform to previous renaming.
compiler/comp_unit_interface.m:
Follow supertypes when computing the required type constructors
whose definitions need to be kept in the implementation section
of a .int file.
compiler/equiv_type.m:
compiler/equiv_type_hlds.m:
Replace equivalence types in supertypes.
compiler/module_qual.qualify_items.m:
Perform module qualification in supertypes.
compiler/hlds_out_module.m:
Write out the "=< supertype" part of subtype definitions.
compiler/parse_tree_out.m:
Write out the "=< supertype" part of subtype definitions.
compiler/recompilation.usage.m:
Follow supertypes when finding used items.
compiler/add_foreign_enum.m:
compiler/add_special_pred.m:
compiler/check_parse_tree_type_defns.m:
compiler/check_typeclass.m:
compiler/code_info.m:
compiler/dead_proc_elim.m:
compiler/decide_type_repn.m:
compiler/det_report.m:
compiler/direct_arg_in_out.m:
compiler/du_type_layout.m:
compiler/foreign.m:
compiler/inst_check.m:
compiler/intermod.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen_test.m:
compiler/ml_unify_gen_util.m:
compiler/post_term_analysis.m:
compiler/prog_type.m:
compiler/recompilation.check.m:
compiler/resolve_unify_functor.m:
compiler/simplify_goal_ite.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/term_norm.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
compiler/unify_proc.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to HLDS changes.
Add comments for future work.
tests/invalid/Mmakefile:
tests/invalid/subtype_abstract.err_exp:
tests/invalid/subtype_abstract.m:
tests/invalid/subtype_circular.err_exp:
tests/invalid/subtype_circular.m:
tests/invalid/subtype_ctor_arg.err_exp:
tests/invalid/subtype_ctor_arg.m:
tests/invalid/subtype_eqv.err_exp:
tests/invalid/subtype_eqv.m:
tests/invalid/subtype_exist_constraints.err_exp:
tests/invalid/subtype_exist_constraints.m:
tests/invalid/subtype_exist_vars.err_exp:
tests/invalid/subtype_exist_vars.m:
tests/invalid/subtype_foreign.err_exp:
tests/invalid/subtype_foreign.m:
tests/invalid/subtype_foreign_supertype.err_exp:
tests/invalid/subtype_foreign_supertype.m:
tests/invalid/subtype_foreign_supertype2.err_exp:
tests/invalid/subtype_foreign_supertype2.err_exp2:
tests/invalid/subtype_foreign_supertype2.m:
tests/invalid/subtype_ho.err_exp:
tests/invalid/subtype_ho.m:
tests/invalid/subtype_invalid_supertype.err_exp:
tests/invalid/subtype_invalid_supertype.m:
tests/invalid/subtype_not_subset.err_exp:
tests/invalid/subtype_not_subset.m:
tests/invalid/subtype_syntax.err_exp:
tests/invalid/subtype_syntax.m:
tests/invalid_submodules/Mercury.options:
tests/invalid_submodules/Mmakefile:
tests/invalid_submodules/subtype_submodule.err_exp:
tests/invalid_submodules/subtype_submodule.m:
tests/valid/Mmakefile:
tests/valid/subtype_basic.m:
Add test cases.
This fixes Mantis bug #512, whose symptom is a compiler abort in some
very specific circumstances. The regression test for the bug below
documents the long causal chain needed to tickle this abort.
compiler/simplify_goal_conj.m:
When deleting unreachable code, set the requanify flag, which also
causes instmap_deltas to be recomputed. The immediate cause of the bug
was an instmap_delta that should have been thus recomputed, but wasn't.
Do this in both places where simplification can delete dead code,
though the Mantis 512 test case involves only one.
tests/valid/bug512.m:
A regression test for this bug.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
Enable the new test case, and run it with the flags that tickle
the bug it is guarding against.
compiler/comp_unit_interface.m:
As above.
tests/valid/int_imp_test.m:
tests/valid/int_imp_test_2.m:
A regression test for the abort that the sanity check caused.
tests/valid/Mmakefile:
Enable the new test case.
This first step deals with the consequences of such removal.
The removal itself will happen in stage 2. That step will
add "is" to the prolog module in the library.
compiler/add_pred.m:
Prepare for "is" being in the prolog module.
compiler/options.m:
Add a way to test whether the change to add_pred.m is in the
installed compiler.
tests/accumulator/base.m:
tests/accumulator/call_in_base.m:
tests/accumulator/chain.m:
tests/accumulator/commutative.m:
tests/accumulator/construct_test.m:
tests/accumulator/dcg.m:
tests/accumulator/deconstruct_test.m:
tests/accumulator/disj.m:
tests/accumulator/func.m:
tests/accumulator/heuristic.m:
tests/accumulator/highorder.m:
tests/accumulator/identity.m:
tests/accumulator/inter.m:
tests/accumulator/nonrec.m:
tests/accumulator/out_to_in.m:
tests/accumulator/qsort.m:
tests/accumulator/simple.m:
tests/accumulator/split.m:
tests/accumulator/swap.m:
tests/benchmarks/cqueens.m:
tests/benchmarks/crypt.m:
tests/benchmarks/deriv.m:
tests/benchmarks/deriv2.m:
tests/benchmarks/nrev.m:
tests/benchmarks/poly.m:
tests/benchmarks/primes.m:
tests/benchmarks/qsort.m:
tests/benchmarks/query.m:
tests/benchmarks/tak.m:
tests/debugger/interactive.m:
tests/declarative_debugger/Mercury.options:
tests/declarative_debugger/io_read_bug.m:
tests/declarative_debugger/queens.exp:
tests/declarative_debugger/queens.m:
tests/dppd/imperative_solve_impl.m:
tests/dppd/map_impl.m:
tests/dppd/max_length_impl.m:
tests/dppd/sum.m:
tests/dppd/upto_sum_impl.m:
tests/par_conj/dep_par_21.m:
tests/tabling/seq.m:
tests/term/dds3_14.m:
tests/term/mmatrix.m:
tests/term/money.m:
tests/term/occur.m:
tests/term/pl4_5_2.m:
tests/term/queens.m:
tests/typeclasses/inference_test.m:
tests/typeclasses/inference_test_2.m:
tests/valid/lazy_list.m:
tests/warnings/duplicate_const.m:
Replace calls to "is" with unifications. In many places,
bring programming style up to date.
library/*.m:
Specifically, delete any predicates and functions whose `pragma obsolete'
dates from 2018 or before. Keep the ones that were obsoleted
only this year or last year.
NEWS:
Announce the changes.
tests/debugger/io_tab_goto.m:
tests/debugger/tabled_read.m:
tests/declarative_debugger/io_stream_test.m:
tests/declarative_debugger/tabled_read_decl.m:
tests/declarative_debugger/tabled_read_decl_goto.m:
tests/general/array_test.m:
tests/hard_coded/mutable_init_impure.m:
tests/hard_coded/remove_file.m:
tests/tabling/mercury_java_parser_dead_proc_elim_bug.m:
tests/tabling/mercury_java_parser_dead_proc_elim_bug2.m:
tests/valid/mercury_java_parser_follow_code_bug.m:
Replace references to predicates and functions that this diff deletes
with their suggested replacements.
In several test cases, bring the programming style up to date.
tests/hard_coded/shift_test.{m,exp}:
Most of this test case tested the now-deleted legacy shift operations.
Replace these with tests of their non-legacy versions, including
testing for the expected exceptions.
tests/hard_coded/shift_test.{m,exp}:
Don't pass --no-warn-obsolete when compiling shift_test.m anymore.