tests/hard_coded/*.m:
Update programming style, unless doing so would change
the meaning of the test, in particular:
- use '.' as a module qualifier in place of '__'
- use {write,print}_line where appropriate
- use if-then-else in place of C -> T ; E
- use state variables in place of DCGs
tests/hard_coded/dir_test.m:
Document what the expected outputs correspond to.
Use a uniform module qualifier in the output.
tests/hard_coded/dir_test.exp*:
Conform to the above change.
compiler/module_qual.m:
The interface of a module A contains items (e.g. predicate declarations)
that refer to entities such as types, insts, modes etc. They may refer
to those entities if (a) they are defined in the interface of module A,
(b) in a parent module of module A, or (c) if they are imported from
another module, module B, which is imported into module A in the interface
of module A.
The old algorithm that attempted to enforce this requirement had a basic
design fault: it based the decision as to whether the use of an entity
in the interface was legal solely on the name of the module that defined
that entity. This correctly implements tests (b) and (c), but it does
not even attempt to implement the interface test part of (a).
It therefore allowed exported items to refer to nonexported entities.
This diff changes the whole design approach to the test. Instead of
keeping a list of modules *all* of whose entities may be used in the
interface of the current module, record for *every* entity whether
it may be used in the interface. Set the permissions differently
in the interface and implementation sections of the current module.
Improve the formatting of the ambiguity error message.
NEWS:
Announce the stricter enforcement of the documented language rules,
in a new section for potentially compatibility-breaking changes.
compiler/check_typeclass.m:
Delete a test for a special case of the situation that module_qual.m
now tests for. If this problem occurs, module_qual.m will pick it up,
and check_typeclass.m will never even be invoked, so this copy of the test
can never succeed.
library/hash_table.m:
Fix code that violated the language rules: we export a type that
includes another type, but didn't export the second type. We now do.
browser/declarative_analyser.m:
browser/declarative_edt.m:
compiler/coverage_profiling.m:
Fix code that violated the language rules. We used to export predicates
and functions whose argument types included nonexported types. As it
happens, none of those predicates and functions actually need to be
exported, so keep them private.
In coverage_profiling.m, don't abstract export a type that is not
used outside the module, and give a function a name that doesn't
clash with a type name.
tests/invalid/bug17.{m,err_exp}:
A new test case to test the error message we get if the module interface
refers to a nonexported type.
tests/invalid/bad_instance.err_exp:
This test case used to get two kinds of errors, one of which was
the illegal use of nonexported type in an exported abstract instance
declaration. We now discover this error earlier, and stop after we
do so. Update the expected error message.
tests/invalid/bad_instance2.{m,err_exp}:
New test case: a modified copy of bad_instance.m, testing the other
kind of error originally tested by bad_instance.m.
tests/invalid/instance_no_type.err_exp:
Update the expected error message.
tests/invalid/Mmakefile:
Enable the new test cases.
tests/benchmarks/query.m:
tests/hard_coded/unused_float_box_test.m:
tests/valid/bug300.m:
tests/valid/deforest_bug.m:
tests/valid/higher_order4.m:
tests/valid/lambda_recompute.m:
tests/valid/mert.m:
tests/valid/reuse_static.m:
tests/valid/switch_detection_bug2.m:
tests/valid/time_yaowl.m:
tests/warnings/unused_args_test.m:
Fix code that violated the language rules, typically by exporting
the type that previously, we illegally used in the module interface.
tests/recompilation/add_type_re.err_exp.2:
Expect the updated ambiguity error message.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the debugger tests,
specify the new line numbers in .inp files and expect them in .exp files.
Estimated hours taken: 18
Branches: main
Move the univ, maybe, pair and unit types from std_util into their own
modules. std_util still contains the general purpose higher-order programming
constructs.
library/std_util.m:
Move univ, maybe, pair and unit (plus any other related types
and procedures) into their own modules.
library/maybe.m:
New module. This contains the maybe and maybe_error types and
the associated procedures.
library/pair.m:
New module. This contains the pair type and associated procedures.
library/unit.m:
New module. This contains the types unit/0 and unit/1.
library/univ.m:
New module. This contains the univ type and associated procedures.
library/library.m:
Add the new modules.
library/private_builtin.m:
Update the declaration of the type_ctor_info struct for univ.
runtime/mercury.h:
Update the declaration for the type_ctor_info struct for univ.
runtime/mercury_mcpp.h:
runtime/mercury_hlc_types.h:
Update the definition of MR_Univ.
runtime/mercury_init.h:
Fix a comment: ML_type_name is now exported from type_desc.m.
compiler/mlds_to_il.m:
Update the the name of the module that defines univs (which are
handled specially by the il code generator.)
library/*.m:
compiler/*.m:
browser/*.m:
mdbcomp/*.m:
profiler/*.m:
deep_profiler/*.m:
Conform to the above changes. Import the new modules where they
are needed; don't import std_util where it isn't needed.
Fix formatting in lots of modules. Delete duplicate module
imports.
tests/*:
Update the test suite to confrom to the above changes.
Estimated hours taken: 100
Branches: main
Make definitions of abstract types available when generating
code for importing modules. This is necessary for the .NET
back-end, and for `:- pragma export' on the C back-end.
compiler/prog_data.m:
compiler/modules.m:
compiler/make.dependencies.m:
compiler/recompilation.version.m:
Handle implementation sections in interface files.
There is a new pseudo-declaration `abstract_imported'
which is applied to items from the implementation
section of an interface file. `abstract_imported'
items may not be used in the error checking passes
for the curent module.
compiler/equiv_type_hlds.m:
compiler/notes/compiler_design.html:
New file.
Go over the HLDS expanding all types fully after
semantic checking has been run.
compiler/mercury_compile.m:
Add the new pass.
Don't write the `.opt' file if there are any errors.
compiler/instmap.m:
Add a predicate instmap_delta_map_foldl to apply
a procedure to all insts in an instmap.
compiler/equiv_type.m:
Export predicates for use by equiv_type_hlds.m
Reorder arguments so state variables and higher-order
programming can be used.
compiler/prog_data.m:
compiler/prog_io_pragma.m:
compiler/make_hlds.m:
compiler/mercury_to_mercury.m:
Handle `:- pragma foreign_type' as a form of type
declaration rather than a pragma.
compiler/hlds_data.m:
compiler/*.m:
Add a field to the type_info_cell_constructor cons_id
to identify the type_ctor, which is needed by
equiv_type_hlds.m.
compiler/module_qual.m:
Donn't allow items from the implementation section of
interface files to match items in the current module.
compiler/*.m:
tests/*/*.m:
Add missing imports which only became apparent with
the bug fixes above.
Remove unnecessary imports which only became apparent with
the bug fixes above.
tests/hard_coded/Mmakefile:
tests/hard_coded/export_test2.{m,exp}:
Test case.
tests/invalid/Mmakefile:
tests/invalid/missing_interface_import2.{m,err_exp}:
Test case.
Estimated hours taken: 3
Branches: main
Get the tests in hard_coded to compile in the grade il. The tests may
still fail because of other reasons.
tests/hard_coded/constraint_order.m:
tests/hard_coded/copy_pred.m:
tests/hard_coded/copy_pred_2.m:
tests/hard_coded/dupcall_impurity.m:
tests/hard_coded/export_test.m:
tests/hard_coded/foreign_import_module.m:
tests/hard_coded/foreign_type3.m:
tests/hard_coded/ho_solns.m:
tests/hard_coded/ho_univ_to_type.m:
tests/hard_coded/impure_foreign.m:
tests/hard_coded/impure_prune.m:
tests/hard_coded/intermod_c_code2.m:
tests/hard_coded/intermod_multimode.m:
tests/hard_coded/multimode.m:
tests/hard_coded/no_inline.m:
tests/hard_coded/rnd.m:
Provide C# implementation of C code.
tests/hard_coded/existential_types_test.m:
tests/hard_coded/frameopt_pragma_redirect.m:
tests/hard_coded/mode_choice.m:
tests/hard_coded/pragma_c_code.m:
tests/hard_coded/pragma_inline.m:
tests/hard_coded/target_mlobjs.m:
tests/hard_coded/unused_float_box_test.m:
Provide Mercury implementation of C code.
tests/hard_coded/redoip_clobber.m:
Provide MC++ implementation of C code.
Estimated hours taken: 8
Branches: main
Soon foreign_proc will be impure by default unless given a promise_pure
or promise_semipure attribute. The syntax has been accepted for some
time, we now add the necessary declarations.
browser/dl.m:
compiler/timestamp.m:
library/*.m:
tests/hard_coded/unused_float_box_test.m:
Add promise_pure and promise_semipure declarations for foreign_procs.
Estimated hours taken: 8
Branches: main
Fix a bug where the MLDS back-end was generating incorrect code when you
pass an argument of type `float' to procedure expecting a polymorphically
typed parameter with mode `unused'.
This bug broke the test cases that used `--trace rep' in
tests/debugger/declarative, if you built the compiler with `--target asm',
because the stage 1 compiler got miscompiled.
compiler/ml_call_gen.m:
Don't unbox arguments that whose mode is top_unused.
tests/hard_coded/Mmakefile:
tests/hard_coded/unused_float_box_test.m:
tests/hard_coded/unused_float_box_test.exp:
A regression test.