mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-20 20:03:44 +00:00
083d376e6598628362ee91c2da170febd83590f4
13 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5a3fa03843 |
Improve programming style in the mdbcomp directory.
mdbcomp/mdbcomp.goal_path.m:
Replace clauses with an explicit switch.
mdbcomp/mdbcomp.m:
Provide C# and Java definitions of the version predicate.
Mdb needs this library only in C grades, but the compiler
has access to it even in C# and Java grades.
mdbcomp/shared_utilities.m:
Fix style.
mdbcomp/slice_and_dice.m:
Replace if-then-else chains with switches.
mdbcomp/sym_name.m:
Document a predicate.
|
||
|
|
310bf54777 | Fix a comment. | ||
|
|
cdbb17662c | Clarify and document how get_ancestors works. | ||
|
|
bd6e6fca8c |
Diagnose names with non-full qualifications.
compiler/typecheck_errors.m:
When the program refers to a predicate, function or data constructor
from a module with only a use_module declaration, it must do so
using its fully qualified name. If it refers to it with an unqualified
or only partially qualified name, the typechecker won't find it,
because the predicate_table and the cons_table record non-fully-qualified
names only for the entities imported with import_module declarations.
When generating error_specs for such errors, look for matches with
the relevant name among the fully-qualified entries in the predicate
and cons tables. If we find some, add a sentence to the error message
about the modules defining such names being imported with use_module,
not import_module.
compiler/hlds_cons.m:
Add a way to look up the definitions of all the constructors with
a given name.
compiler/pred_table.m:
Add a way to look up the definitions of all the predicates or functions
with a given name.
mdbcomp/sym_name.m:
Add some functionality for use by typecheck_errors.m.
tests/invalid/type_error_use_module.m:
tests/invalid/type_error_use_module_2.m:
tests/invalid/type_error_use_module.err_exp:
A test case for the new functionality.
tests/invalid/Mmakefile:
tests/invalid/Mercury.options:
Enable the new test case. Sort the list of multimodule tests.
tests/invalid/errors2.err_exp:
Expect the new addendum to an existing error message.
|
||
|
|
d465fa53cb |
Update the COPYING.LIB file and references to it.
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.
|
||
|
|
1a778114db |
Fix more warnings from --warn-inconsistent-pred-order-clauses.
mdbcomp/builtin_modules.m:
mdbcomp/feedback.automatic_parallelism.m:
mdbcomp/feedback.m:
mdbcomp/mdbcomp.goal_path.m:
mdbcomp/mer_mdbcomp.m:
mdbcomp/prim_data.m:
mdbcomp/program_representation.m:
mdbcomp/rtti_access.m:
mdbcomp/slice_and_dice.m:
mdbcomp/sym_name.m:
mdbcomp/trace_counts.m:
Fix inconsistencies between (a) the order in which functions and predicates
are declared, and (b) the order in which they are defined.
In most modules, either the order of the declarations or the order
of the definitions made sense, and I changed the other to match.
In some modules, neither made sense, so I changed *both* to an order
that *does* make sense (i.e. it has related predicates together).
Move one predicate that is needed in two modules from one of them
to a third module (prim_data.m), since that is the one that defines
the type for which the predicate is a utility predicate.
In some places, put dividers between groups of related
functions/predicates, to make the groups themselves more visible.
In some places, fix comments or programming style.
mdbcomp/MDBCOMP_FLAGS.in:
Since all the modules in this directory are now free from any warnings
generated by --warn-inconsistent-pred-order-clauses, specify that option
by default in this directory to keep it that way.
|
||
|
|
5649f36c80 |
Handle "use_module in interface, import_module in implementation".
If a module m1 imports module m2 using a use_module declaration in its
interface section but also imports it using an import_module declaration
in its implementation section, then references to entities defined in m2
in the interface of m1 must be module qualified, but similar references
in the implementation of m1 need NOT be module qualified.
The Mercury compiler has long had a bug that allowed entities imported
in the implementation of module m1 to be used in the interface of m1,
against the rules of the language. When I fixed that bug on 2015 nov 11,
the compiler became unable to properly process the situation described
in the paragraph above, because it still had another bug, which was that
it had a single setting for module qualification requirements: either it
was required *everywhere* in m1, or it was required *nowhere* in m1.
This diff fixes that bug (mantis bug 401) by allowing different requirements
in this respect in the interface of m1 versus its implementation.
It also changes the de-facto meaning of what exactly a use_module declaration
requires. The reference manual says only:
Uses of entities imported using @code{use_module} declarations
@emph{must} be explicitly module qualified.
This WAS unambiguous when it was written in june 1997, a few months before
submodules were added to the language. With a flat module system, there were
no nested module names, so either the module name was present, or it wasn't.
In the presence of nested modules, though, it IS ambiguous: HOW MUCH of
the module name must be present? The reference manual is silent on this.
At the moment, in the presence of a use_module for module ma.mb.mc,
a predicate p1 in ma.mb.mc may of course be referred to as ma.mb.mc.p1,
but may also be referred to as mb.mc.p1, or even just mc.p1. The specification
of mc is always required, but exactly WHICH of the previous module name
components are required depends on whether e.g. ma or ma.mb were themselves
imported via use_module or import_module declarations. The code implementing
the check (find_matches_in_permissions_map in module_qual.id_set.m) is itself
not too clear.
This diff changes the rules so that all references to anything imported
via a use_module declarations have to be fully qualified. This is stricter
than the existing rule, but it is MUCH simpler, and it better matches
the original intent of use_module declarations, which is the avoidance
of ALL POSSIBILITY of ambiguity.
NEWS:
doc/reference_manual.texi:
Document this change to the language.
compiler/prog_item.m:
Change the representation of sections in .int* files. Previously,
we recorded whether the interface file that the section was from
was read for an `import_module' or a `use_module' declaration.
We now allow the recording of the fact that it had both declarations,
a use_module in the interface and an import_module in the implementation.
compiler/modules.m:
Treat modules that have both a `use_module' declaration in interface
and an `import_module' declaration in the implementation as being of this
new internal section kind.
Add some infrastructure for debugging similar problems in the future.
compiler/module_qual.id_set.m:
Change the permissions system. Instead of recording *independently*
whether (a) an entity may be used in the interface and (b) whether
references to it must be qualified, record *separately* whether
(a) it may be used in the interface, and if so with what qualification
requirements, and (b) what its qualification requirements are in the
implementation. Unlike the old permission setup, the new one allows us
to express the "use_module in interface, import_module in implementation"
situation.
Implement the change to the language, by requiring full module
qualification of entities imported via use_module declarations.
This allows us to use a single parameterized piece of code to handle
both unqualified and qualified references, whereas before we used
separate pieces of code for them.
Change the way we handle errors in module qualification. Instead of
looking only for precise matches only, and looking for the possible causes
of errors only if we find either no matches or two or more matches, we now
return the near-miss matches as well, the ones that we need to decide
on what error message we want to generate. While this is slightly slower,
it is *much* simpler, since it allows us to avoid duplicating the search
code: once for precise matches only, once for no-match errors, and once
for multiple-match errors.
compiler/module_qual.collect_mq_info.m:
Set permissions for symbol access according to the new permissions system.
Code that previously triggered the bug will use the new interface file
section kind, and can now have its permissions record correctly.
compiler/module_qual.qual_errors.m:
Use a single predicate to generate error messages for all situations
in which there is not a single precise match for a module qualification.
This allows us to diagnose multiple potential problems with a single
lookup.
Change the wording of an existing error message to avoid a possibly-untrue
implication.
compiler/hlds_data.m:
Rename a field of the type_defn type to better document its meaning.
compiler/make_hlds.m:
Document the meaning of the need_qualifier field in sec_infos.
compiler/add_type.m:
compiler/make_hlds_separate_items.m:
compiler/module_qual.m:
compiler/pred_table.m:
compiler/parse_tree_out.m:
compiler/prog_item_stats.m:
Conform to the above changes.
mdbcomp/sym_name.m:
Add a utility predicate for use in looking for near-miss matches
in module qualification.
Make the documentation of a related predicate more precise.
tests/invalid/bad_instance.m:
tests/submodules/class.m:
tests/submodules/nested.m:
tests/submodules/nested3.m:
tests/submodules/parent.m:
Make names fully module qualified where the language rules now require it.
tests/submodules/deeply_nested.m:
Comment out a part of the test that tested the partially qualified names,
since these are now not allowed.
tests/invalid/errors.err_exp:
Expect a now-improved error message.
tests/invalid/test_nested.err_exp:
tests/invalid/transitive_import.err_exp:
tests/invalid/undef_type.err_exp:
Expect a now less-likely-to-mislead error message.
tests/valid_seq/int_impl_imports.m:
tests/valid_seq/int_impl_imports_2.m:
The test case for mantis bug 401.
tests/valid_seq/Mmakefile:
Enable the new test case.
|
||
|
|
6650ffad55 | Convert (C->T;E) to (if C then T else E). | ||
|
|
62ec97d443 |
Report imports shadowed by other imports.
If a module has two or more import_module or use_module declarations
for the same module, (typically, but not always, one being in its interface
and one in its implementation), generate an informational message about
each redundant declaration if --warn-unused-imports is enabled.
compiler/hlds_module.m:
We used to record the set of imported/used modules, and the set of
modules imported/used in the interface of the current module. However,
these sets
- did not record the distinction between imports and uses;
- did not allow distinction between single and multiple imports/uses;
- did not record the locations of the imports/uses.
The first distinction was needed only by module_qual.m, which *did*
pay attention to it; the other two were not needed at all.
To generate messages for imports/uses shadowing other imports/uses,
we need all three, so change the data structure storing such information
for *direct* imports to one that records all three of the above kinds
of information. (For imports made by read-in interface and optimization
files, the old set of modules approach is fine, and this diff leaves
the set of thus *indirectly* imported module names alone.)
compiler/unused_imports.m:
Use the extra information now available to generate a
severity_informational message about any import or use that is made
redundant by an earlier, more general import or use.
Fix two bugs in the code that generated warnings for just plain unused
modules.
(1) It did not consider that a use of the builtin type char justified
an import of char.m, but without that import, the type is not visible.
(2) It scanned cons_ids in goals in procedure bodies, but did not scan
cons_ids that have been put into the const_struct_db. (I did not update
the code here when I added the const_struct_db.)
Also, add a (hopefully temporary) workaround for a bug in
make_hlds_passes.m, which is noted below.
However, there are at least three problems that prevent us from enabling
--warn-unused-imports by default.
(1) In some places, the import of a module is used only by clauses for
a predicate that also has foreign procs. When compiled in a grade that
selects one of those foreign_procs as the implementation of the predicate,
the clauses are discarded *without* being added to the HLDS at all.
This leads unused_imports.m to generate an uncalled-for warning in such
cases. To fix this, we would need to preserve the Mercury clauses for
*all* predicates, even those with foreign procs, and do all the semantic
checks on them before throwing them away. (I tried to do this once, and
failed, but the task should be easier after the item list change.)
(2) We have two pieces of code to generate import warnings. The one in
unused_imports.m operates on the HLDS after type and mode checking,
while module_qual.m operates on the parse tree before the creation of
the HLDS. The former is more powerful, since it knows e.g. what types and
modes are used in the bodies of predicates, and hence can generate warnings
about an import being unused *anywhere* in a module, as opposed to just
unused in its interface.
If --warn-unused-imports is enabled, we will get two separate set of
reports about an interface import being unused in the interface,
*unless* we get a type or mode error, in which case unused_imports.m
won't be invoked. But in case we do get such errors, we don't want to
throw away the warnings from module_qual.m. We could store them and
throw them away only after we know we won't need them, or just get
the two modules to generate identical error_specs for each warning,
so that the sort_and_remove_dups of the error specs will do the
throwing away for us for free, if we get that far.
(3) The valid/bug100.m test case was added as a regression test for a bug
that was fixed in module_qual.m. However the bug is still present in
unused_imports.m.
compiler/make_hlds_passes.m:
Give hlds_module.m the extra information it now needs for each item_avail.
Add an XXX for a bug that cannot be fixed right now: the setting of
the status of abstract instances to abstract_imported. (The "abstract"
part is correct; the "imported" part may not be.)
compiler/intermod.m:
compiler/try_expand.m:
compiler/xml_documentation.m:
Conform to the change in hlds_module.m.
compiler/module_qual.m:
Update the documentation of the relationship of this module
with unused_imports.m.
compiler/hlds_data.m:
Document a problem with the status of instance definitions.
compiler/hlds_out_module.m:
Update the code that prints out the module_info to conform to the change
to hlds_module.m.
Print status information about instances, which was needed to diagnose
one of the bugs in unused_imports.m. Format the output for instances
nicer.
compiler/prog_item.m:
Add a convenience predicate.
compiler/prog_data.m:
Remove a type synonym that makes things harder to understand, not easier.
compiler/modules.m:
Delete an XXX that asks for the feature this diff implements.
Add another XXX about how that feature could be improved.
compiler/Mercury.options.m:
Add some more modules to the list of modules on which the compiler
should be invoked with --no-warn-unused-imports.
compiler/*.m:
library/*.m:
mdbcomp/*.m:
browser/*.m:
deep_profiler/*.m:
mfilterjavac/*.m:
Delete unneeded imports. Many of these shadow other imports, and some
are just plain unneeded, as shown by --warn-unused-imports. In a few
modules, there were a *lot* of unneeded imports, but most had just
one or two.
In a few cases, removing an import from a module, because it *itself*
does not need it, required adding that same import to those of its
submodules which *do* need it.
In a few cases, conform to other changes above.
tests/invalid/Mercury.options:
Test the generation of messages about import shadowing on the existing
import_in_parent.m test case (although it was also tested very thoroughly
when giving me the information needed for the deletion of all the
unneeded imports above).
tests/*/*.{m,*exp}:
Delete unneeded imports, and update any expected error messages
to expect the now-smaller line numbers.
|
||
|
|
ef44f50bee |
Eliminate the old module_defn item.
After my earlier changes to the item list, we used module_defns for only
two things: recording when one module includes another, and recording
when one module imports or uses another. After this diff, both those
pieces of information are stored separately in each item block.
This has two benefits.
The first benefit is that it allows us to use the type system to enforce
structural invariants about where include_module, import_module and use_module
declarations may appear. The one invariant that we now enforce is that
optimization files may not contain either include_module or import_module
declarations, though they may contain use_module declarations. I suspect that
there are also similar invariants about interface files, but finding them
requires something like this change.
The second benefit is that it allows traversals of item blocks to scan
only the part of the item block that may contain the object of interest.
While reading in interface and optimization files, we used to scan the
full item list several times to find included and imported modules; those
scans can now look at just the relevant information. Since the item lists
that need to be processed usually include all the declarations in a
substantial number of other modules, including some (such as list.m) that
have LOTS of declarations, the speedup can be substantial. On tools/speedtest,
the speedup is 1.5%.
compiler/prog_item.m:
Make the change described above.
Provide utility predicates on the new types representing include_module,
import_module and use_module declarations.
Move an old utility predicate from here to prog_io.m, since only prog_io.m
uses it.
compiler/module_imports.m:
Several fields of the module_imports type contained sets of module names,
but stored them as lists. Change these to actual sets, to distinguish them
from the lists whose order is actually important. (Basically, the order
of processing .trans_opt files is important, but the order in which
we read in .int0, .int3, .int2, .int and .opt files isn't.) In several
places, this also avoids the need for conversions of lists to sets
for set operations, and then back to lists.
compiler/modules.m:
This module had several predicates that processed list of module names.
Make these operate on sets of module names instead, and break each of them
into two predicates: one that decides whether there is a next module name,
and if yes whether it has been processed already, and one to do the actual
processing if needed. This avoid the need for excessive indentation.
The code that discovers what other modules' interface files may need
to be read is now simpler due to the updated item_block structure.
Remove the submodule whose job it was to discover what modules are included
in items or item blocks, since that task has now become trivial, and is
now done by a utility predicate in prog_item.m. Since this was the second
last submodule (of the original eight), the last submodule is now the
whole module. Therefore this module now has significantly greater cohesion
than it had before.
compiler/write_module_interface_files.m:
compiler/prog_io_item.m:
Parse include_module, import_module and use_module declarations as
markers, not as items.
compiler/prog_io.m:
Expect include_module, import_module and use_module declarations as
markers, not as items.
compiler/split_parse_tree_src.m:
Discover included submodules more simply with the updated item_block
structure.
compiler/compile_target_code.m:
Put the arguments of the predicates in this module in a more standard
order.
compiler/recompilation.version.m:
Conform to the above changes. Note a possible bug.
Use a bespoke type to replace some bools.
compiler/check_raw_comp_unit.m:
compiler/comp_unit_interface.m:
compiler/deps_map.m:
compiler/equiv_type.m:
compiler/generate_dep_d_files.m:
compiler/get_dependencies.m:
compiler/hlds_module.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make_hlds_passes.m:
compiler/mercury_compile.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_to_mercury.m:
compiler/module_deps_graph.m:
compiler/module_qual.m:
compiler/prog_io_find.m:
compiler/read_modules.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/trans_opt.m:
compiler/write_deps_file.m:
Conform to the above changes.
mdbcomp/sym_name.m:
Provide a utility predicate to get the set of ancestors of a module
as a set as well as a list.
tests/invalid/exported_unify3.err_exp:
tests/invalid/ii_parent.ii_child.err_exp:
Update the expected error messages, which refer to line numbers in
.int0 files, which have now changed, as we now put all import_module
declarations before ordinary items.
(Error messages shouldn't refer to automatically generated files,
but that is a separate concern.)
|
||
|
|
f2043fc9bd |
Replace the item list with more structured ASTs.
The parts of the compiler that run before the HLDS is constructed used to use
a raw list of items to represent source files (.m), interface files (.int0,
.int3, .int2 and .int) and optimization files (.opt, and .trans_opt).
These lists had structure, but this structure was implicit, not explicit,
and its invariants were never really documented.
This diff changes that. It replaces the item list with FIVE separate types.
Three of these each represent the unprocessed content of one file:
- parse_tree_int represents the contents of one interface file;
- parse_tree_opt represents the contents of one optimization file;
- parse_tree_src represents the contents of one source file.
Two of these each represent the processed contents of one or more files:
- raw_compilation_unit represents the contents of one module in a source file.
(The source file may contain several nested modules; the compilation unit
represents just one.)
- aug_compilation_unit represents the contents of one module in a source file,
just like raw_compilation_unit, but it is augmented with the contents of the
interface and optimization files of the other modules imported (directly or
indirectly) by the original module.
These five separate concepts all used to be represented by the same type,
list(item), but different invariants applied to the structure of those lists.
The most important of those invariants at least are now explicit in the types.
I think it is entirely possible that there are other invariants I haven't
discovered and documented (for example, .int3 files must have stricter
invariants on what can appear in them than .int files), but discovering
and documenting these should be MUCH easier after this change.
I have marked many further opportunities for improvements with "XXX ITEM_LIST".
Some of these include moving code between modules, and the creation of new
modules. However, I have left acting on those XXXs until later, in order to
keep the size of this diff down as much as possible, for easier reviewing.
compiler/prog_item.m:
Define the five new AST types described above, and utility predicates
that operate on them.
In the rest of this change, I tried, as much as possible, to change
predicates that used to take item lists as arguments to make them change
one of these types instead. In many cases, this required putting
the argument lists of those predicates into a more consistent order.
(Often, predicates that operated on the contents of the module
took the name of the module and the list of items in the module
not just as separate arguments, but as separate arguments that
weren't even next to each other.)
Define types that identify the different kinds of interface and
optimization files (.int, .int2 etc). These replace the string suffixes
we used to use to identify file types. Predicates that used to take strings
representing suffixes as arguments now have to specify whether they can
handle all these file types (source, interface and optimization),
or just (e.g.) all interface file types.
We used to have items corresponding to `:- module' and `:- end_module'.
Delete these; this information is now implicit in the structure of the
relevant AST. The parser handles the corresponding terms as markers,
not items; these markers are live only during parsing.
We used to have module_defns corresponding to `:- interface' and
`:- implementation'. Delete these; this information is now also implicit
in the structure of the relevant AST. Delete also, for the same reason,
the module_defns used to mark the starts of sublists in the overall lists
of items whose items came from the interface files or optimization files
of other modules. The former are now markers during parsing. The latter
are never parsed, but are created directly, after parsing has been done.
Delete the pragma type for `:- pragma source_file'. This is never
needed later; it is now a marker during parsing.
Change the internal representation of `:- import' and `:- use'.
It used to store a list of module names, but that list was an actual list
only during parsing; after that, it always had exactly one element.
It now stores one module name, and the parser has a mechanism to convert
one read-in term to more than one item, for use with terms such as
`:- import_module a, b'.
Delete the internal representation of `:- export', which was never
implemented, since if it IS ever implemented, it will almost certainly
be in a different form, which will need different support.
Document some further opportunities for simplification, later.
(This diff is already more than big enough.)
compiler/prog_io_item.m:
Rewrite the top-level part of this module. Instead of returning an item
for every parsed term, distinguish between parsing items that end up
in item lists inside ASTs, and parsing markers that end up creating
the STRUCTURE of those ASTs.
compiler/prog_io.m:
Rewrite the meat of this module. Instead of reading in a simple item list,
we now have to read in three different parse trees with three different
grammars, each of which is more complex than a simple list.
compiler/read_modules.m:
We used to have a map that mapped file names to the contents of those
files. We now need three separate maps, for interface files, optimization
files and source files, due to their separate types.
(We don't actually use the map for optimization files, which seems
to be a potential performance bug. The root cause of that problem
us that while intermod.m and the grab_*modules part of modules.m do
similar jobs, they don't use the same mechanisms.)
Replace the read_module predicate with the predicates read_module_src
and read_module_int, since these now return different types.
To avoid having to create AST-type-specialized variants of
read_module_ignore_errors and read_module_if_changed, give each of
read_module_{src,int} arguments that optionally tell them to ignore errors
and/or to read the module only if changed (though the "and" part of
"and/or" should not be needed.) These options already existed, but
they weren't exported.
compiler/timestamp.m:
Define the type we use for this option in read_modules.
compiler/status.m:
New module, containing mostly
- stuff carved out of hlds_pred.m, which defines the import_status type,
and the predicates that operate on it;
- stuff carved out of make_hlds_passes.m, which defines the item_status
type and the predicates that operate on that; and
- stuff carved out prog_data.m, which defines the section (now
module_section) and import_locn types.
It also contains the new section kinds we now use to represent item blocks
that were imported from interface and optimization files.
compiler/parse_tree.m:
compiler/notes/compiler_design.html:
Add status.m to the parse_tree package.
compiler/hlds_pred.m:
compiler/prog_data.m:
Remove the stuff now in status.m.
compiler/error_util.m:
Provide a mechanism to control the order of messages with respect to
ALL other messages, not just those that also specify ordering.
compiler/mercury_to_mercury.m:
Provide predicates for printing out parse_tree_* and *_compilation_unit,
since printing out a simple item list is no longer enough for debugging.
Pretty-print type definitions nicely.
Replace a boolean with a purpose-specific enum.
compiler/modules.m:
Rewrite virtually all this module to make it work on the new AST
representations. Generate more detailed error messages for duplicate
module inclusions. Note lots of possibilities for further improvements,
including in the documentation. Mark places I am still not sure about,
especially places where I am not sure *why* the code is doing
what it is doing.
compiler/module_imports.m:
This module stores the data structure in which we accumulate the stuff
imported into a compilation unit, i.e. it is in these data structures
that a raw_compilation_unit becomes an aug_compilation_unit. Modify
the data structure and the predicates that operate on it to work on the
new AST representations, not on an (apparently) simple list of items.
Avoid ambiguities by adding a prefix to field names.
Add some convenience predicates.
compiler/module_qual.m:
Perform module qualification on both raw lists of items (for use when
generating .int3 files) but also on item blocks (for use pretty much
in every other situation).
Generate warnings about module imports that are unnecessarily in the
module interface using the module's context (the context of the `:- module'
declaration), not line 1 of the relevant file.
compiler/prog_io_error.m:
Split some error categories more finely, since some error kinds here
actually used to be reported for more than one distinct situation.
compiler/prog_io_util.m:
Provide utility predicates that operate on nonempty lists.
compiler/recompilation.version.m:
Make the comparison of the old and new contents of the interface file
work on two parse_tree_ints, not on two raw sequences of items.
Delete a boolean option that was always `yes', never 'no'.
compiler/recompilation.m:
Turn some functions into predicates to allow the use of state variable
notation.
Avoid ambiguities by adding a prefix to field names.
compiler/write_module_interface_files.m:
Besides updating the code in this module to work on the new parse tree
representations, also use cords instead of reversed lists in several cases.
Note many possibilities for further improvements.
library/list.m:
Move the type one_or_more here from the compiler directory, since
we now use it in more than one compiler module, and this is its natural
home.
mdbcomp/sym_name.m:
Rename "match_sym_name" to "partial_sym_name_matches_full", since this
better describes its job.
Add a det version of sym_name_get_module_name.
compiler/equiv_type.m:
Rename some types to make them more expressive.
compiler/accumulator.m:
compiler/add_class.m:
compiler/add_foreign_enum.m:
compiler/add_foreign_proc.m:
compiler/add_mode.m:
compiler/add_pragma.m:
compiler/add_pragma_tabling.m:
compiler/add_pred.m:
compiler/add_solver.m:
compiler/add_special_pred.m:
compiler/add_type.m:
compiler/assertion.m:
compiler/base_typeclass_info.m:
compiler/check_typeclass.m:
compiler/ctgc.util.m:
compiler/dead_proc_elim.m:
compiler/dep_par_conj.m:
compiler/dependency_graph.m:
compiler/deps_map.m:
compiler/det_report.m:
compiler/elds_to_erlang.m:
compiler/equiv_type_hlds.m:
compiler/erl_code_gen.m:
compiler/export.m:
compiler/format_call.m:
compiler/higher_order.m:
compiler/hlds_data.m:
compiler/hlds_module.m:
compiler/hlds_out_pred.m:
compiler/inst_check.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/lambda.m:
compiler/lco.m:
compiler/make.module_dep_file.m:
compiler/make_hlds.m:
compiler/make_hlds_error.m:
compiler/make_hlds_passes.m:
compiler/make_tags.m:
compiler/mercury_compile.m:
compiler/ml_proc_gen.m:
compiler/ml_type_gen.m:
compiler/mode_errors.m:
compiler/oisu_check.m:
compiler/par_loop_control.m:
compiler/polymorphism.m:
compiler/post_term_analysis.m:
compiler/post_typecheck.m:
compiler/pred_table.m:
compiler/prog_io_dcg.m:
compiler/prog_io_find.m:
compiler/prog_io_pragma.m:
compiler/prog_io_sym_name.m:
compiler/prog_io_type_defn.m:
compiler/prog_io_typeclass.m:
compiler/prop_mode_constraints.m:
compiler/push_goals_together.m:
compiler/qual_info.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/simplify_proc.m:
compiler/smm_common.m:
compiler/special_pred.m:
compiler/ssdebug.m:
compiler/stm_expand.m:
compiler/structure_reuse.analysis.m:
compiler/structure_reuse.direct.m:
compiler/structure_reuse.indirect.m:
compiler/structure_reuse.versions.m:
compiler/structure_sharing.analysis.m:
compiler/structure_sharing.domain.m:
compiler/table_gen.m:
compiler/term_constr_initial.m:
compiler/term_constr_main.m:
compiler/termination.m:
compiler/trace_params.m:
compiler/trans_opt.m:
compiler/type_class_info.m:
compiler/type_ctor_info.m:
compiler/typecheck.m:
compiler/typecheck_errors.m:
compiler/typecheck_info.m:
compiler/unify_proc.m:
compiler/untupling.m:
compiler/unused_args.m:
compiler/unused_imports.m:
compiler/write_deps_file.m:
compiler/xml_documentation.m:
Conform to the changes above.
tests/hard_coded/higher_order_func_test.m:
tests/hard_coded/higher_order_syntax.m:
Avoid a warning about importing a module in the interface, not the
implementation.
tests/invalid/after_end_module.err_exp:
tests/invalid/any_mode.err_exp:
tests/invalid/bad_end_module.err_exp:
tests/invalid/bigtest.err_exp:
tests/invalid/bug113.err_exp:
tests/invalid/duplicate_modes.err_exp:
tests/invalid/errors.err_exp:
tests/invalid/errors1.err_exp:
tests/invalid/errors2.err_exp:
tests/invalid/funcs_as_preds.err_exp:
tests/invalid/inst_list_dup.err_exp:
tests/invalid/invalid_main.err_exp:
tests/invalid/missing_interface_import2.err_exp:
tests/invalid/no_exports.err_exp:
tests/invalid/occurs.err_exp:
tests/invalid/predmode.err_exp:
tests/invalid/prog_io_erroneous.err_exp:
tests/invalid/type_inf_loop.err_exp:
tests/invalid/typeclass_missing_det_3.err_exp:
tests/invalid/typeclass_test_11.err_exp:
tests/invalid/types.err_exp:
tests/invalid/undef_inst.err_exp:
tests/invalid/undef_mode.err_exp:
tests/invalid/undef_type.err_exp:
tests/invalid/unicode1.err_exp:
tests/invalid/unicode2.err_exp:
tests/invalid/vars_in_wrong_places.err_exp:
tests/warnings/unused_import.exp:
tests/warnings/unused_interface_import.exp:
Update the expected outputs in the invalid and warnings directories
to account for one or more of the following five changes.
Error messages that warn about a module not exporting anything
used to always refer to line 1 of the module's source file.
Now expect these messages to refer to the actual context of the module,
which is the context of its `:- module' declaration.
Expect a similarly updated context for messages that warn about
unnecessarily importing modules in the interface, not in the
implementation.
Expect a similarly updated context for messages that warn about
importing a module via both `:- import_module' and `:- use_module'.
For the modules that follow the `:- module' declaration directly with code,
also expect an error message about the missing section marker.
For modules that have terms after the `:- end_module' declaration,
replace "end_module" with "`:- end_module'" in the error message.
tests/invalid/func_class.{m,err_exp}:
New test case. It is a copy of the old tests/valid/func_class.m, which
is missing more than one module marker. The expected output is what I think
we should generate. The test case currently fails, because we currently
print only a subset of the expected errors. I am pretty sure the reason
for that is that old code I have not modified simply throws away the
missing error messages. Fixing this is work for the near future.
tests/invalid/Mmakefile:
Enable the new test case.
tests/misc_tests/pretty_print_test.exp:
Expect the pretty-printed output to use four-space indentation,
per our current style guide, since the compiler now generates such output.
tests/misc_tests/pretty_print_test.m:
Clean up the source code of the test as well.
tests/valid/complicated_unify.m:
tests/valid/det_switch.m:
tests/valid/easy_nondet_test.m:
tests/valid/error.m:
tests/valid/func_class.m:
tests/valid/func_int_bug_main.m:
tests/valid/higher_order.m:
tests/valid/higher_order2.m:
tests/valid/implied_mode.m:
tests/valid/indexing.m:
tests/valid/multidet_test.m:
tests/valid/nasty_func_test.m:
tests/valid/semidet_disj.m:
tests/valid/stack_alloc.m:
tests/valid/switches.m:
Add missing section markers to these modules. They used to follow
the `:- module' declaration directly with code.
|
||
|
|
3f11ad2183 |
generate dummy table stats and reset preds for non-tabling backends.
This fixes Mantis bug #368. compiler/add_pragma_tabling.m: On backends that don't support tabling, generate the declarations for table statistics and reset predicates as usual if the tabling memo requests them, but make the definition a dummy definition. Dummy statistics predicates return statistics full of zeros, while dummy reset predicates do nothing. compiler/add_pragma_tabling.m: Pass the qual_info now needed by add_pragma_tabling.m. library/table_statistics.m: Add a predicate to return dummy statistics. Switch from error/1 to unexpected/3. mdbcomp/sym_name.m: Add a utility predicate for converting a sym_name to a term, since add_pragma_tabling.m now needs this. Make the order of predicate definitions match the order of predicate declarations. tests/valid/table_aux_preds_erlang.m: New test case to test for the presence of the bug. tests/valid/Mmakefile: Enable the new test case. |
||
|
|
500948d549 |
Break up mdbcomp/prim_data.m. The new modules have much better cohesion.
mdbcomp/sym_name.m:
New module, containing the part of the old prim_data.m that
dealt with sym_names.
mdbcomp/builtin_modules.m:
New module, containing the part of the old prim_data.m that
dealt with builtin modules.
mdbcomp/prim_data.m:
Remove the things that are now in the two new modules.
mdbcomp/mdbcomp.m:
deep_proiler/Mmakefile:
slice/Mmakefile:
Add the two new modules.
browser/*.m:
compiler/*.m:
deep_proiler/*.m:
mdbcomp/*.m:
slice/*.m:
Conform to the above changes.
|