compiler/prog_data.m:
Delete the simple_call_id data type, since it is isomorphic
to the pf_sym_name_arity type, which more clearly specifies
what is stored inside it.
compiler/prog_out.m:
Rename (all three versions of) simple_call_id_to_string to
pf_sym_name_orig_arity_to_string, both to conform to the change
in the input data type, and to emphasize that the resulting string
will contain the *original* arity of functions (which does not include
the return value), which is one less than the arity in the
pf_sym_name_arity structure (which, in accordance with the
convention inside the compiler that the arity is the length
of the argument list, *does* include the return value).
Delete the provision inside simple_call_id_to_string, now
pf_sym_name_orig_arity_to_string, for special handling of the names
of the predicates we use to implement promises, because it seems that
*none* of the call sites to any of the three versions of this function
can actually pass to it the identity of such a predicate. These calls
refer to a predicate or mode declaration item (which promise predicates
do not have), to clause or foreign_proc items (which again, promise
predicates cannot have) or calls to the predicate (promise predicates
cannot be called).
Delete the exported predicate simple_call_id_to_sym_name_arity.
It was called from exactly one place, inside prog_out.m itself,
and this diff inlines that call.
Avoid unnecessary forwarding of work from prog_out.m to error_util.m.
Delete (all three versions of) write_simple_call_id. The changes
below replace all their (few) uses with calls to
pf_sym_name_orig_arity_to_string.
compiler/error_util.m:
Replace the simple_call() error piece with qual_pf_sym_name_orig_arity,
and add a new version unqual_pf_sym_name_orig_arity. Their names
explicitly say that they print the original arities of functions,
also say whether they strip away any module qualification on the
sym_name inside the pf_sym_name_arity. We prefer the unqual version
in situations where the module qualifier is implicit, which usually means
that it must be the same as the name of the module being compiled, because
it reduces visual clutter for readers of error messages.
Put {qual,unqual}_pf_sym_name_orig_arity next to their most closely
related function symbols, {qual,unqual}_sym_name_arity, in the
format_component type. (This yields a few inconsequential changes
in the order of error_specs when sorted.)
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_pragma.m:
compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/check_libgrades.m:
compiler/check_parse_tree_type_defns.m:
compiler/check_promise.m:
compiler/check_typeclass.m:
compiler/convert_parse_tree.m:
compiler/equiv_type.m:
compiler/goal_expr_to_goal.m:
compiler/hlds_data.m:
compiler/hlds_desc.m:
compiler/hlds_goal.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/hlds_pred.m:
compiler/inst_util.m:
compiler/llds_out_instr.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make_hlds_error.m:
compiler/make_hlds_warn.m:
compiler/mark_tail_calls.m:
compiler/ml_unify_gen_construct.m:
compiler/mlds_to_c_stmt.m:
compiler/mode_errors.m:
compiler/mode_info.m:
compiler/modecheck_util.m:
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.qualify_items.m:
compiler/parse_item.m:
compiler/parse_module.m:
compiler/parse_type_repn.m:
compiler/polymorphism.m:
compiler/post_typecheck.m:
compiler/pre_quantification.m:
compiler/pred_table.m:
compiler/prog_item.m:
compiler/recompilation.version.m:
compiler/term_constr_build.m:
compiler/termination.m:
compiler/type_ctor_info.m:
compiler/typecheck.m:
compiler/typecheck_errors.m:
compiler/typecheck_info.m:
compiler/unify_gen_construct.m:
compiler/unused_imports.m:
Conform to the changes above. Where I am pretty sure that in an error
message, the module qualifier of a name must be the current module,
use unqual_pf_sym_name_orig_arity instead of qual_pf_sym_name_orig_arity.
Add some sanity checks where they seem appropriate.
Replace sequences of io.write_strings with uses of io.format where this
yields clearer code. (This is why there were no remaining calls to
write_simple_call_id.)
Shorten some too-long lines.
In add_pred.m, make the order of some predicate definitions match
the order of the calls to them.
tests/invalid/ambiguous_method.err_exp:
tests/invalid/ambiguous_method_2.err_exp:
tests/invalid/bad_pred_arity.err_exp:
tests/invalid/bad_sv_unify_msg.err_exp:
tests/invalid/bigtest.err_exp:
tests/invalid/bug113.err_exp:
tests/invalid/bug197.err_exp:
tests/invalid/bug278.err_exp:
tests/invalid/bug410.err_exp:
tests/invalid/bug476.err_exp:
tests/invalid/bug487.err_exp:
tests/invalid/complex_constraint_err.err_exp:
tests/invalid/constrained_poly_insts.err_exp:
tests/invalid/errors.err_exp:
tests/invalid/errors1.err_exp:
tests/invalid/errors2.err_exp:
tests/invalid/exported_mode.err_exp:
tests/invalid/field_syntax_error.err_exp:
tests/invalid/foreign_singleton.err_exp:
tests/invalid/funcs_as_preds.err_exp:
tests/invalid/imported_mode.err_exp:
tests/invalid/invalid_binary_literal.err_exp:
tests/invalid/invalid_float_literal.err_exp:
tests/invalid/invalid_hex_literal.err_exp:
tests/invalid/invalid_octal_literal.err_exp:
tests/invalid/make_opt_error.err_exp:
tests/invalid/missing_det_decls.err_exp:
tests/invalid/multimode_syntax.err_exp:
tests/invalid/null_char.err_exp:
tests/invalid/occurs.err_exp:
tests/invalid/record_syntax_errors.err_exp:
tests/invalid/ref_to_implicit_pred.err_exp:
tests/invalid/require_tailrec_1.err_exp:
tests/invalid/require_tailrec_1.err_exp2:
tests/invalid/require_tailrec_2.err_exp:
tests/invalid/require_tailrec_2.err_exp2:
tests/invalid/require_tailrec_3.err_exp:
tests/invalid/require_tailrec_3.err_exp2:
tests/invalid/state_vars_test2.err_exp:
tests/invalid/state_vars_test3.err_exp:
tests/invalid/state_vars_test5.err_exp:
tests/invalid/type_inf_loop.err_exp:
tests/invalid/typeclass_constraint_extra_var.err_exp:
tests/invalid/typeclass_mode_2.err_exp:
tests/invalid/typeclass_test_12.err_exp:
tests/invalid/typeclass_test_2.err_exp:
tests/invalid/typeclass_test_9.err_exp:
tests/invalid/types.err_exp:
tests/invalid/types2.err_exp:
tests/invalid/unbound_type_vars.err_exp:
tests/invalid/with_type.err_exp:
tests/invalid_purity/purity_nonsense.err_exp:
tests/invalid_purity/purity_nonsense2.err_exp:
tests/warnings/double_underscore.exp:
tests/warnings/pragma_source_file.exp:
tests/warnings/singleton_test.exp:
tests/warnings/singleton_test.exp2:
tests/warnings/singleton_test.exp3:
tests/warnings/singleton_test.exp4:
tests/warnings/singleton_test_state_var.exp:
tests/warnings/warn_return.exp:
tests/warnings/warn_return.exp2:
tests/warnings/warn_return.exp3:
tests/warnings/warn_succ_ind.exp:
tests/warnings/warn_succ_ind.exp2:
tests/warnings/warn_succ_ind.exp3:
tests/warnings/warn_succ_ind.exp4:
Update all these expected output files. Most changes are due to
predicate and function names no longer being module qualified when
the module qualification is obvious. A few changes are due to the
change in the relative ordering of the function symbols of the
format_component type.
For singleton_test, warn_return and warn_succ_ind in warnings,
the changes to the non-C .exp files were done by hand, so they
may have the wrong white space.
compiler/mercury_compile_main.m:
When we generate more messages for the user than we show, either
because of --limited-error-context options or because the user has
not asked for the verbose part of messages, we used to print a reminder
about this fact in only one case:
- at the end of the compilation, and
- only if the exit status wasn't zero.
Both of these condition was wrong.
- If we were compiling modules a, b, c, d ... z, we could get a message
about more messages being available being printed after the compilation
of a module (z) for which we generated *no* messages at all, just because
some message earlier in the list got such messages.
- If the compilation generated no errors but only warnings, then
we never printed reminders about any verbose parts of those warnings
being held back.
Fix both of these issues by
- separating the code doing the reminder into its own predicate,
and invoking it at the end of the processing of each module
(leaving a call at its old location where it is invoked
after we have processed all modules), and
- not making the invocation conditional on exit status.
tests/warnings/ambiguous_overloading.exp:
tests/warnings/arg_order_rearrangment.exp:
tests/warnings/bug477.exp:
tests/warnings/infinite_recursion.exp:
tests/warnings/simple_code.exp:
tests/warnings/singleton_test.exp:
tests/warnings/singleton_test.exp2:
tests/warnings/singleton_test.exp3:
tests/warnings/singleton_test.exp4:
Update these to expect the "For more information, recompile with `-E'"
message, now that we don't hide it.
tests/warnings/singleton_test.m:
Document what the four .exp files are for.
tests/warnings/singleton_test.exp2:
Update this expected output -- the line numbers in the output
have changed.
tests/warnings/warn_contiguous_foreign.m:
Add a missing C# foreign_proc for the predicate p/2.
Mmake.workspace:
Do not set MLOBJS in the java and erlang grades.
tests/warnings/singleton_text.exp[234]:
tests/warnings/warn_succ_ind.exp[234]:
Update these expected outputs to conform to changes to both the file
generating the warning and also to the way the Mercury compiler prints
them.
Estimated hours taken: 4
Branches: main
If a clause head has several singleton variables, generate a single warning for
them, instead of separate warnings for different singletons. The reason why
this wasn't happening already is that the relevant code sees clauses in which
terms in clause heads have already been replaced by headvar variables. The
extra verbosity this generated was annoying.
compiler/make_hlds_warn.m:
Make the change described above.
Fix the placement of commas in the messages we produce in another
circumstance.
Reduce the amount of parameter passing required by grouping
always-passed-together arguments into a structure.
Factor out some common code.
Give some predicates more meaningful names.
Put the arguments of some predicates in a more natural order.
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_pragma.m:
Conform to the changes in make_hlds_warn.m.
tests/warnings/singleton_test.{m,exp,exp2,exp3,exp4}:
Add a test of the new functionality to this test case, and update the
expected outputs accordingly. (The .exp{2,3,4} files looked like they
have missed out on some previous updates, and one of them still looks
as if it isnt't wrapped right.)
tests/warnings/warn_succ_ind.exp:
Update this file to expect the fixed version of a message.
Branches: main
valid/deforest_loop.m:
valid/exported_foreign_type2.m:
valid/headvar_not_found.m:
valid/ho_and_type_spec_bug.m:
valid/inst_perf_bug_1.m:
valid/intermod_impure2.m:
valid/lambda_recompute.m:
valid/livevals_seq.m:
valid/mostly_uniq_neg.m:
valid/multidet_prune1.m:
valid/nondet_live.m:
valid/param_mode_bug.m:
valid/simplify_bug.m:
valid/soln_context.m:
valid/switch_detection_bug2.m:
valid/tricky_assert2.m:
valid/uniq_unify.m:
valid/vn_float.m:
warnings/purity_warnings.m:
warnings/singleton_test.m:
Add Erlang pragma foreign_* for these test cases.
warnings/singleton_test.exp:
Update line numbers in expected output for C.
warnings/singleton_test.exp2:
warnings/singleton_test.exp3:
Update line numbers and format C# and Java (untested).
warnings/singleton_test.exp4:
Add expected output for Erlang.
Estimated hours taken: 0.5
Branches: main
Get tests/warnings to pass in grade java.
tests/warnings/foreign_term_invalid.m:
Add Java and C# "pragma foreign_proc" clauses.
tests/warnings/purity_warnings.m:
tests/warnings/singleton_test.m:
Add Java "pragma foreign_proc" clauses.
tests/warnings/singleton_test.exp*:
Adjust line numbers to reflect the above changes to the source,
and also add a new .exp3 file containing the expected warnings
for grade java.
Estimated hours taken: 4
Branches: main
Fixes for the testing infrastructure for the il grade.
hard_coded/Mmakefile:
Don't do the fact table tests in the il and java grades.
hard_coded/string_strip.m:
hard_coded/string_strip.exp:
Add a new line at the end of the program, so that the last
line is complete.
hard_coded/string_strip.exp2:
The IL grade does string comparison in a different order to
the C grades, thus the second version of string_strip.
hard_coded/user_compare.m:
Add il versions of the foreign procs.
invalid/Mmakefile:
valid/Mmakefile:
Remove the reserve_tag tests from the il and java grades.
invalid/foreign_type_2.err_exp2:
Update the expected output now that '.' is the module
seperator.
warnings/singleton_test.m:
warnings/singleton_test.exp2:
Modify this test to include tests for the IL backend.