library/array.m:
library/builtin.m:
library/construct.m:
Fix copy-and-paste errors.
library/arrayd2d.m:
Use the mode array2d_di instead of array_di in a spot.
Delete an extra space from an exception message.
library/bimap.m:
Fix formatting.
library/bit_buffer.m:
Fix inverted argument types.
library/dir.m:
Say that make_single_directory/4 returns an error rather
than saying that it fails.
library/io.m:
Fix errors in obsolete pragmas.
library/assoc_list.m:
library/bag.m:
library/cord.m:
library/deconstruct.m:
library/enum.m:
library/fat_sparse_bitset.m:
library/getopt*.m:
library/int*.m:
library/io*.m:
library/type_desc.m:
Fix documentation errors.
tests/hard_coded/array2d_from_array.exp:
Conform to the changed exception message in array2d.m.
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.
library/array.m:
Add uint versions of most of this module's operations.
NEWS.md:
Mention the new operations.
library/edit_distance.m:
Use the new array operations to eliminate some casts.
library/edit_seq.m:
Minor style fix.
tests/hard_coded/array_gen.{m,exp}:
tests/hard_coded/array_test_2.{m,exp}:
Extend the tests of array.m's operations to the corresponding uint
versions. Expect the output for the new versions.
tests/hard_coded/array_resize.m:
tests/hard_coded/array_shrink.m:
Extend the tests of array.m's operations to the corresponding uint
versions, but generate output only if their results differ from the
original int versions. (They don't differ.)
tests/hard_coded/array_primitives.m:
Style fixes.
library/array2d.m:
Use the new builtin for bounds checks.
library/array.m:
Document why using the new builtin for bounds checks
would probably not lead to a speedup.
library/array.m:
library/assoc_list.m:
library/bimap.m:
library/bitmap.m:
library/construct.m:
library/deconstruct.m:
library/dir.m:
library/hash_table.m:
library/injection.m:
library/io.stream_db.m:
library/kv_list.m:
library/list.m:
library/map.m:
library/robdd.m:
library/stream.string_writer.m:
library/term_conversion.m:
library/term_to_xml.m:
library/tree234.m:
library/type_desc.m:
library/version_hash_table.m:
For nearly every ordinary function in this directory that can fail in its
primary mode (all of which were semidet functions),
- provide a semidet predicate as an alternative, if it did not
already exist,
- implement the function in terms of the predicate, instead of vice versa,
- mark the semidet function as obsolete in favor of the semidet predicate
version,
- fix all the resulting warnings, and then
- comment out the obsolete pragmas (at least for now).
Note that this diff does not touch the semidet function in the
enum typeclass, or the functions that implement that method
in instances.
NEWS.md:
Announce the new predicates in the (documented) modules of the library.
browser/term_rep.m:
compiler/lp_rational.m:
compiler/mcsolver.m:
compiler/mode_ordering.m:
compiler/mode_robdd.equiv_vars.m:
compiler/mode_robdd.implications.m:
compiler/old_type_constraints.m:
compiler/pickle.m:
compiler/prog_event.m:
compiler/type_ctor_info.m:
compiler/var_table.m:
tests/hard_coded/bitmap_empty.m:
tests/hard_coded/construct_mangle.m:
tests/hard_coded/construct_packed.m:
tests/hard_coded/construct_test.m:
tests/hard_coded/dummy_type_construct.m:
tests/hard_coded/expand.m:
tests/hard_coded/foreign_enum_rtti.m:
tests/hard_coded/subtype_rtti.m:
tests/hard_coded/term_to_univ_test.m:
tests/hard_coded/type_to_term.m:
tests/hard_coded/type_to_term_bug.m:
Stop calling the semidet functions from the library that were temporarily
marked obsolete.
In a few places, add explicit type qualification to avoid warnings
about unresolved polymorphism.
tests/hard_coded/test_injection.exp:
Expect an abort message from the predicate version of a semidet function.
tests/declarative_debugger/ho_2.exp2:
Update this .exp file for a previous commit.
library/array.m:
library/char.m:
library/float.m:
library/int.m:
library/int16.m:
library/int32.m:
library/int64.m:
library/int8.m:
library/list.m:
library/one_or_more.m:
library/string.m:
library/tree234.m:
library/uint.m:
library/uint16.m:
library/uint32.m:
library/uint64.m:
library/uint8.m:
library/version_array.m:
Mark the X_to_doc function in each of these modules as obsolete,
and make it a forwarding function to the actual implementation
in pretty_printer.m. The intention is that when these forwarding
functions are eventually removed, this will also remove the dependency
of these modules on pretty_printer.m. This should help at least some
of these modules escape the giant SCC in the library's dependency graph.
(It does not make sense that a library module that adds code to increment
an int thereby becomes dependent on pretty_printer.m through int.m.)
library/pretty_printer.m:
Move all the X_to_doc functions from the above modules here.
Fix the one_or_more_to_doc function, which was
- missing the comma between the two arguments of the one_or_more
function symbol, and
- would print "..., ...]" instead of just "...]" at the end of the
tail list when that list exceeded the limits of the specified pp_params.
Rename one of the moved types along with its function symbols,
to reduce ambiguity.
Put arrays before their indexes in the argument lists of some of
the moved functions.
Some of the moved X_to_doc functions for compound types returned
a doc that had an indent wrapper. These indents differed between the
various X_to_doc functions without any visible reason, but they are
also redundant. The callers can trivially add such wrappers if they
want to, but taking them off, if they want them off, is harder.
Eliminate the problem by deleting all such indent wrappers.
Add formatters for the intN, uintN and one_or_more types to the
default formatter map. Their previous absence was an oversight.
Add a function, get_formatter_map_entry_types, that returns the ids
of the types in the formatter_map given to the function. It is intended
for tests/hard_coded/test_pretty_printer_defaults.m, but is exported
for anyone to use.
tests/hard_coded/test_pretty_printer_defaults.{m,exp}:
Use get_formatter_map_entry_types to print the default formatter map
in a format that is much more easily readable.
NEWS:
Announce all the user-visible changes above.
library/ra_list.m:
As above.
Rename ra_list_lookup to ra_list_search, since it fails if the item
to be accessed does not exist. Add a version, ra_list_lookup, which
aborts in that case.
Add predicates to append two ra_lists, and to convert ra_lists
to just plain lists.
Change the argument order of some predicates to be more
state variable friendly.
Add some documentation.
library/bt_array.m:
Delete the moved code, and update the references to the changed predicates.
library/Mercury.options:
Now that the ra_list predicates have been moved to their own module,
stop giving bt_array.m a free pass on inconsistent predicate order.
library/MODULES_DOC:
library/library.m:
Add ra_list.m as a documented module of the Mercury standard library.
library/array.m:
Delete a predicate that served as a test for an ancient bug fix.
NEWS:
Announce both the new ra_list module, and the deletion of the predicate
from array.m.
tests/hard_coded/array_sort.m:
Don't call the predicate deleted from array.m.
tests/hard_coded/ra_list_test.{m,exp}:
A new test case to test operations on ra_lists.
tests/hard_coded/Mmakefile:
Enable the new test case.
library/array.m:
library/bt_array.m:
library/pprint.m:
In each of these modules,
- put related predicates next to each other,
- put the groups of related predicates into a meaningful order, and
- improve the documentation of some predicates, and
- improve some variable names in the implementation, including giving
explicit names to some function results.
library/Mercury.options:
Enable the warning about inconsistent predicate order for two of those
modules, but not bt_array.m, pending a decision about making its
informal "submodule" an actual separate module.
It has been deprecated since Mercury 20.01.
library/random.m:
Delete the old generator.
library/array.m:
Delete the predicate random_permutation/4.
NEWS:
Announce the above.
tests/hard_coded/string_hash.m:
Update this test to use the new RNG framework.
tests/hard_coded/Mmakefile:
tests/hard_coded/random_permutation.{m,exp}:
tests/hard_coded/random_simple.{m,exp}:
Delete these tests, they were specific to the old RNG.
extras/curs/samples/nibbles.m:
extras/solver_types/library/any_array.m:
Replace use of the old RNG.
In the Mercury standard library, every exported predicate or function
has (or at least *should* have) a comment that documents it, including
the meanings of its arguments. About 35-40% of these modules put `'s
(left and right quotes) around the names of the variable representing
those arguments. Some tried to do it consistently (though there were spots
with unquoted or half quoted names), while some did it only a few places.
This is inconsistent: we should either do it everywhere, or nowhere.
This diff makes it nowhere, because
- this is what the majority of the standard library modules do;
- this is what virtually all of the modules in the compiler, profiler,
deep_profiler etc directories do;
- typing all those quotes when adding new predicates in modules that
follow this convention is a pain in the ass; and because
- on many modern terminals, `' looks non-symmetrical and weird.
Likewise, the comment explaining a predicate often started with
% `predname(arguments)' returns ...
This diff deletes these quotes as well, since they add nothing useful.
This diff does leave in place quotes around code fragments, both terms
and goals, where this helps delineate the boundaries of that fragment.
library/array.m:
As above.
Turn an aux function into a predicate to allow the use of state vars.
Use more meaningful variable names.
NEWS:
Announce the new predicate.
library/*.m:
Delete Erlang foreign code and foreign types.
Delete documentation specific to Erlang targets.
library/deconstruct.m:
Add pragma no_determinism_warning to allow functor_number_cc/3
to compile for now.
library/Mercury.options:
Delete workaround only needed when targetting Erlang.
browser/listing.m:
mdbcomp/rtti_access.m:
Delete Erlang foreign code and foreign types.
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.
library/array.m:
Workaround the fact that C#'s 'is' operator has some fairly surprising
behaviour with arrays of integer types.
tests/hard_coded/array_primitives.{m,exp}:
tests/hard_coded/array_shrinks.{m,exp}:
Improve the coverage of these tests.
Change array.fetch_items/4 to return an empty list for an empty range in the
case where the endpoints of that range are not within the array bounds.
library/array.m:
As above.
deep_profiler/autopar_types.m:
Undo Zoltan's recent workaround for the above behaviour.
tests/hard_coded/array_fetch_items.{m,ex}:
Add tests for this behaviour.
Change the behaviour of the above predicate in the following ways:
- throw an index_out_of_bounds/0 exception instead of a software_error/0
exception if either index is out of bounds.
- perform the out of bounds check before checking if the third argument is
less than the second.
Add an more comprehensive test of fetch_items/4.
library/array.m:
Make it clear that the range of indexes passed to fetch_items is
inclusive.
Throw an index_out_of_bounds/0 exception instead of a software_error/1
exception if either of the indexes is out of bounds.
Perform the array bounds check first, before checking if the third
argument is less than the second.
Document what happens if the upper index is less than the lower one.
Fix a typo in the documentation of fill_range/4.
Update the definition of to_list/2 to conform with the above change
to the array bounds checks.
NEWS:
Announce the above change to the semantics of fetch_items/0.
tests/hard_coded/Mmakefile:
tests/hard_coded/array_fetch_items.{m,exp}:
Add a more comprehensive
Report out-of-bounds errors more precisely for array.fill_range/5.
library/array.m:
As above.
NEWS:
Announce the addition.
tests/hard_coded/Mmakefile:
tests/hard_coded/array_swap.{m,exp}:
Add a test for array.swap/4.
tests/hard_coded/array_fill.exp:
Conform to the second change above.
array.resize/4 has inconsistent behaviour across backends if its first argument
is negative; make it throw an exception if the first argument is negative.
library/array.m:
As above.
NEWS:
Announce the change.
tests/hard_coded/Mmakefile:
tests/hard_coded/array_resize.{m,exp}:
Add a more extensive test case for array.resize.
The behaviour of array.shrink/3 was not defined if its first argument was
negative. If this occurred, the C backends would return an empty array, while
the non-C backends would abort. This diff changes the behaviour of shrink/3 so
that it throws an exception if its first argument is negative.
The implementation of shrink/3 for the Java backend did not handle the case
where the array's element type was represented by the one the following Java
primitive types: byte, short, long and float. Handle those cases.
library/array.m:
Make the above fixes.
Fix a typo in my previous commit.
NEWS:
Note the change in behaviour if the first argument of shrink/3 is
negative.
tests/hard_coded/Mmakefile:
tests/hard_coded/array_shrink.{m,exp}:
Add a test case.
library/array.m:
Handle all Java primitive types in the implementation of
array.copy/2.
tests/hard_coded/Mmakefile:
tests/hard_coded/array_copy.{m,exp}:
Add a test case.
library/array.m:
library/array2d.m:
Add the new predicates.
Add a note a likely problem with another predicate.
NEWS:
Announce them.
tests/hard_coded/Mmakfile:
tests/hard_coded/array_fill.{m,exp}:
Add a test case.
browser/collect_lib.m:
browser/declarative_execution.m:
browser/dl.m:
browser/io_action.m:
compiler/make.util.m:
compiler/pickle.m:
compiler/process_util.m:
compiler/prog_event.m:
library/array.m:
library/benchmarking.m:
library/bit_buffer.m:
library/builtin.m:
library/char.m:
library/deconstruct.m:
library/dir.m:
library/erlang_rtti_implementation.m:
library/int.m:
library/int16.m:
library/int32.m:
library/int64.m:
library/int8.m:
library/io.m:
library/math.m:
library/mutvar.m:
library/private_builtin.m:
library/profiling_builtin.m:
library/rtti_implementation.m:
library/store.m:
library/string.format.m:
library/string.m:
library/table_builtin.m:
library/term_size_prof_builtin.m:
library/thread.m:
library/time.m:
library/type_desc.m:
library/uint16.m:
library/uint32.m:
library/uint64.m:
library/uint8.m:
ssdb/ssdb.m:
As above. This mostly involved two things.
The first was grouping foreign_procs by predicate instead of by language.
In a few cases, this revealed that some predicates *had* no foreign_proc
for a language, while related predicates did have one that just aborted
if called. This diff adds similar aborting foreign_procs to predicate/
language combinations that were missing them, when this seemed obviously
the right thing to do.
The second was moving pragmas about a predicate from the middle of the
block of clauses of that predicate to the start of that block.
library/array.m:
The current modes for array.map do not match what the implementation
actually does: specifically, map does not destructively update its
input array argument.
Call unsafe_init/3 in a few spots where it is safe to do so.
tests/hard_coded/ho_array_ops.{m,exp}:
Extend this test to cover array.map.
library/array.m:
Use unsafe lookups in the implementation of equality and
comparison. In these cases the lookups are safe since
the necessary bounds checks are done by the caller.
Avoid unnecessary module qualification.
tests/hard_coded/Mmakefile:
tests/hard_coded/array_unify_compare.{m,exp}:
Add a systematic test for array equality and comparison.
library/array.m:
Make array.map_corresponding_foldl/6 throw an exception if the input
arrays differ in size. This brings its behaviour into line with that of
the other "corresponding" predicates. It also avoids the unsafe behaviour
that can currently result when the second input array has fewer elements
than the first.
Add some additional modes to array.map_corresponding_foldl/6.
Replace calls to error/1 with calls to unexpected/2 throughout this
module.
NEWS:
Announce the above change.
tests/hard_coded/ho_array_ops.{m,exp}:
Extend this test to cover map_corresponding_foldl/6.
library/array.m:
Add the above predicates.
NEWS:
Announce the additions.
tests/hard_coded/Mmakefile:
tests/hard_coded/ho_array_ops.{m,exp}:
Add tests of the new predicates.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.
COPYING.LIB:
Add a special linking exception to the LGPL.
*:
Update references to COPYING.LIB.
Clean up some minor errors that have accumulated in copyright
messages.
library/array.m:
Add det_least_index, semidet_least_index, det_greatest_index,
semidet_greatest_index functions.
Deprecate least_index, greatest_index with the intention of making
them semidet eventually.
NEWS:
Announce changes.
library/array.m:
library/bt_array.m:
Do not assume that the lower bound is zero in the documentation for
array.max.
Make explicit the argument order of bounds/3 predicates
and document behaviour on empty arrays.
Currently we only allow non-primitive Java types to used with foreign_type
pragmas. This means that for foreign types that map on to Java primitive types
we have to use their boxed form (e.g. java.lang.Long, java.lang.Float etc) in
the foreign_type pragma. Doing so results in unnecessary boxing and is a
source of errors (e.g. accidently comparing for reference equality instead of
value equality).
This change causes the MLDS->Java code generator to recognise primitive
foreign_types and generate code that works for them directly. (In effect
their handling is not really different to how the builtin types are handled.)
doc/reference.texi:
Change the language so Java foreign types are allowed to be a
primitive Java types.
compiler/mlds_to_java.m:
Recognise foreign types that are defined as primitive types in Java and
generate code that avoids the need for (some) boxing of them.
library/array.m:
Handle arrays of Java bytes, shorts, longs and floats specially.
(boolean, char, int and double were already handled thus.)
NEWS:
Announce the above.
tests/hard_coded/Mmakefile:
tests/hard_coded/test_java_foreign_primitive.{m,exp}:
Test that foreign types work with primitive types in Java.
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_managed.m:
compiler/il_peephole.m:
compiler/ilasm.m:
compiler/ilds.m:
Delete the modules making up the MLDS->IL code generator.
compiler/globals.m:
compiler/prog_data.m:
Delete IL as a target and foreign language.
compiler/prog_io_pragma.m:
Delete the max_stack_size/1 foreign proc attribute. This was only
ever required by the IL backend.
compiler/options.m
Delete options used for the IL backend.
compiler/write_deps_file.m:
Don't generate mmake targets for .il files etc.
compiler/*.m:
Conform to the above changes.
compiler/notes/compiler_design.html
compiler/notes/work_in_progress.html
Conform to the above changes.
library/*.m:
Delete IL foreign_proc and foreign_export pragmas.
README.DotNet:
Delete this file.
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
mdbcomp/Mmakefile:
mfilterjavac/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
slice/Mmakefile:
Conform the above changes.
configure.ac:
Don't check that IL is a supported foreign language when performing the
up-to-date check.
Delete the '--enable-dotnet-grades' option.
scripts/Mmake.vars.in:
Delete variables used for the IL backend (and in on case by the Aditi
backend).
scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
scripts/Mmake.rules:
scripts/canonical_grade.sh-subr:
tools/bootcheck:
Delete stuff related to the 'il' and 'ilc' grades.
doc/reference_manual.texi:
Delete the documentation of the 'max_stack_size' option.
doc/user_guide.texi:
Delete stuff related to the IL backend.
tests/hard_coded/csharp_test.{m,exp}:
tests/invalid/foreign_type_missing.{m,err_exp}:
tests/valid/csharp_hello.m:
Delete these tests: they are no longer relevant.
tests/hard_coded/equality_pred_which_requires_boxing.m:
tests/hard_coded/foreign_import_module.m:
tests/hard_coded/foreign_import_module_2.m:
tests/hard_coded/foreign_type.m:
tests/hard_coded/foreign_type2.m:
tests/hard_coded/foreign_type3.m:
tests/hard_coded/intermod_foreign_type2.m:
tests/hard_coded/lp.m:
tests/hard_coded/user_compare.m:
tests/invalid/foreign_type_2.m:
tests/invalid/foreign_type_missing.{m,err_exp}:
tests/invalid/foreign_type_visibility.m:
tests/invalid/illtyped_compare.{m,err_exp}:
tests/submodules/external_unification_pred.m
tests/valid/big_foreign_type.m
tests/valid/solver_type_bug.m
tests/valid_seq/foreign_type_spec.m
tests/valid_seq/intermod_impure2.m
Delete IL foreign_procs where necessary.
tests/hard_coded/Mmakefile
tests/invalid/Mercury.options
tests/invalid/Mmakefile
tests/submodules/Mmakefile
tests/valid/Mercury.options
tests/valid/Mmake.valid.common
tests/valid/Mmakefile
tests/valid_seq/Mmakefile
tests/valid_seq/Mercury.options
Conform to the above changes.