Commit Graph

536 Commits

Author SHA1 Message Date
Zoltan Somogyi
fdd141bf77 Clean up the tests in the other test directories.
tests/invalid/*.{m,err_exp}:
tests/misc_tests/*.m:
tests/mmc_make/*.m:
tests/par_conj/*.m:
tests/purity/*.m:
tests/stm/*.m:
tests/string_format/*.m:
tests/structure_reuse/*.m:
tests/submodules/*.m:
tests/tabling/*.m:
tests/term/*.m:
tests/trailing/*.m:
tests/typeclasses/*.m:
tests/valid/*.m:
tests/warnings/*.{m,exp}:
    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 tests
    that check compiler error messages, expect the new line numbers.

browser/cterm.m:
browser/tree234_cc.m:
    Import only one module per line.

tests/hard_coded/boyer.m:
    Fix something I missed.
2015-02-16 12:32:18 +11:00
Zoltan Somogyi
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.
2015-02-05 23:08:46 +11:00
Zoltan Somogyi
c5d6885bca Fix in inappropriate warning.
compiler/simplify_goal_ite.m:
    Normally, we generate a warning if a negated goal either cannot succeed
    or always succeeds. However, if the negation was duplicated as part of
    the implementation of a switch, then this is wrong: a negated goal
    that always succeeds when execution takes one of the arms may always fail
    when execution takes another arm, and vice versa. So don't generate
    such warnings in such situations.

tests/valid/negation_in_dupl_for_switch.m:
    A new test case for this problem.

tests/valid/Mmakefile
    Enable the new test case.

tests/valid/Mercury.options:
    Set up the new test case to fail if the bug is not fixed.

    Replace space sequences with tabs where needed.
2015-01-23 02:47:39 +11:00
Zoltan Somogyi
d33273d033 Tell vim not to expand tabs in Makefiles.
This file-specific setting will override a default setting of expandtabs
in $HOME/.vimrc.

*/Makefile:
*/Mmakefile:
    As above.

tests/hard_coded/.gitignore:
    Don't ignore the purity subdir. This ignore must have been left over
    from when purity.m was a test in hard_coded, not hard_coded/purity,
    and it ignored an executable, not a directory.
2015-01-08 22:07:29 +11:00
Zoltan Somogyi
f0a1701bc8 Don't generate unused module warnings for implicitly imported format modules.
This fixes Mantis bug #370.

compiler/prog_data.m:
    Add a predicate to record that a predicate called "format" has
    been seen, so the compiler should treat the modules that may be implicitly
    imported in presence of such calls as being "used", in the sense that
    we shouldn't generate unused module warnings for them.

    Give the predicates that handle used modules meaningful names.

compiler/unused_imports.m:
    Call the new predicate in prog_data.m when we process any predicate
    called "format". We do this even if the callee is not string.format,
    io.format or stream.string_writer.format, since the parser may not
    have known this when implicitly importing the modules used in the
    translation of calls to those predicates.

    Give some predicates better names.

compiler/equiv_type.m:
compiler/hlds_module.m:
compiler/mercury_compile_front_end.m:
    Conform to the changes above

tests/valid/no_warn_format_imports.m:
    The test case for Mantis bug #370, under a more meaningful name.

tests/valid/Mmakefile:
tests/valid/Mercury.options:
    Enable the new test case, and compile it with the options
    required to manifest the bug, if it exists.
2014-12-30 00:05:01 +11:00
Zoltan Somogyi
ebc10c087e Add missing imports needed for format predicates (Mantis bug 371).
compiler/module_imports.m:
    Don't just scan a few kinds of items, scan all items that contain
    goals and/or terms. This includes the instance items that caused
    mantis bug 371, as well as some others (promises, mutables, and
    type definitions).

compiler/prog_data.m:
    Delete an out-of-date comment.

tests/valid/string_format_in_instance.m:
    Add the Mantis test case under a meaningful name.

tests/valid/Mmakefile:
    Enable the new test case.
2014-12-23 00:42:42 +11:00
Zoltan Somogyi
ddda8fd12b Fix mantis bug 361.
compiler/table_gen.m:
    Fix the bug.

tests/valid/bug361.m:
    The test case.

tests/valid/Mmakefile:
    Enable the test case.

doc/reference_manual.texi:
    Document why, despite not crashing the compiler, the code of the test case,
    and similar code, won't do what it is intended to do.
2014-09-16 05:19:33 +02:00
Peter Wang
338b5cb98e Fix some bugs with constrained polymorphic modes.
1. An inst variable from the head of the clause could be bound in the body.
The mode error in the call `P(X)' was not detected because the inst
variable I could be bound to ground.

	:- pred p(pred(T), T).
	:- mode p(pred(in(I =< ground)) is det, in) is det.

	p(P, X) :- P(X).

2. In David Overton's thesis, a get_subst function produces an inst
substitution from the callee's initial insts to the arguments' initial
insts, and the substitution is applied to all insts from the callee.
In the implementation we actually build the substitution while matching
the arguments' insts with the callee's insts, but we lost some precision
by not applying the incremental substitutions built as we match a list
of insts.

3. We rename apart the callee's inst variables from our own, but did not
keep the merged inst varset.  When a renamed inst variable appears in a
mode error it would be printed without its original name.
(could this avert more serious problems?)

4. inst_merge_3 was missing a case.

Some of these bugs may not be apparent due to the hack in
inst_matches_final_3 which allows a ground inst to match any bound inst.
A similar hack exists in inst_matches_binding_3.

compiler/inst_util.m:
	Handle in inst_merge_3 the case
	    InstA \= constrained_inst_var(_, _),
	    InstB = constrained_inst_var(_, _).

	Move InstA = not_reached case to inst_merge_2 to maintain
	inst_merge(not_reached, InstB @ constrained_inst_var(_, _)) = InstB

compiler/inst_match.m:
	Improve precision of inst var substitution computed in
	handle_inst_var_subs_2, following dmo's thesis.

compiler/mode_util.m:
compiler/modecheck_call.m:
	Keep the merged inst varsets after renaming.

compiler/mode_info.m:
	Add "head inst vars" in mode_info structure.

compiler/modecheck_util.m:
	Add get_constrained_inst_vars to extract constrained inst vars from a
	list of mode.

	Make modecheck_var_has_inst_list_* fail if the computed substitution
	would change the constraints of any head inst variables.

compiler/modes.m:
	Initialise mode_info with head inst variables.

compiler/pd_info.m:
compiler/pd_util.m:
	Conform to change in mode_info_init (not specifically tested).

compiler/prog_mode.m:
	Export inst_apply_substitution.

	Make rename_apart_inst_vars return the merged inst varset.

	Fix comments.

tests/invalid/Mmakefile:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/constrained_poly_insts2.m:
tests/valid/Mmakefile:
tests/valid/constrained_poly_multi.m:
	Add test cases.

NEWS:
	Announce fix.
2014-09-12 16:11:28 +10:00
Peter Wang
011e7688c7 Do not escape character strings in internal atom representation.
The internal representation of a character constant as an atom term
should not use escaped character syntax; the escaping should occur
when writing the external representation only.

compiler/hlds_out_mode.m:
compiler/intermod.m:
compiler/prog_util.m:
compiler/type_constraints.m:
compiler/typecheck.m:
	Fix instances of the bug.

tests/valid/Mercury.options
tests/valid/Mmakefile
tests/valid/intermod_char.m
tests/valid/intermod_char2.m
	Add test case.  The .opt file was invalid because the character
	in the clause head was doubly-escaped.
2014-05-26 15:28:53 +10:00
Paul Bone
dde8f920eb Fix bug #309
Make existential casts from dummy types assign the value NULL rather than
reading a bogus value.

Bug #309 occurs when a dummy type is existentially quantified and the
resulting existentially typed value needs to get placed on the stack for
some reason.  The stack slot chosen in these cases has a negative stack slot
number, as it was allocated for the dummy typed value, this can cause the
code generator to crash.

We fix this by transforming an existential cast from a dummy type to an
assignment of the value zero during LLDS code generation.  Normally these
casts are transformed to copies from the old variable's rval into the new
variable's lval.  This fixes the problem because a constant such as zero
does not need a stack slot.  Using zero rather than an arbitrary value (that
may have been left in a register) may also minimise the amount of pointers
kept to memory that could be freed.

compiler/call_gen.m:
    As above.

tests/valid/exists_dummy.m:
tests/valid/Mmakefile:
    Added a test case for bug #309
2014-01-28 14:40:35 +11:00
Paul Bone
982d22247b Merge branch 'version-13_05-branch' 2013-11-28 13:21:39 +11:00
Peter Wang
553a108fc1 Fix handling of unifications in float_regs pass.
The float_regs.m pass did not consider `deconstruct' unifications which
actually further instantiate the LHS, and inadvertently changed the inst
of a variable on the RHS from being previously bound to free, e.g.

        E = e(X, _),        % X ground
        F = f(1, _, _),
        F = f(_, X, _),     % X free

compiler/float_regs.m:
        Only change the uni_mode of the variable on the RHS of the
        deconstruction if it goes from free to bound.

tests/valid/Mmakefile:
tests/valid/bug301.m:
        Add test case.
2013-10-29 17:30:39 +11:00
Paul Bone
3cd1e95293 Merge branch 'version-13_05-branch' 2013-10-08 13:39:58 +11:00
Paul Bone
3476082376 Add test cases for bug300
tests/valid/bug300.m:
tests/valid/Mmakefile:
    This simple test case can detect the bug in Java grades.

tests/valid/Mercury.options:
    Run the new test case with --optimize-constructor-last-call

tests/hard_coded/bug300.m:
tests/hard_coded/bug300.exp:
tests/hard_coded/Mmakefile:
    This more complicated test case can detect the bug in C grades.  However
    it requires specific CFLAGS, beyond LCMC, to do so.  The symptoms of the
    bug appear differently in this case.

tests/hard_coded/Mercury.options:
    Setup MCFLAGS so that the test case can detect the bug.
2013-10-08 13:35:01 +11:00
Julien Fischer
a03f1b8b15 Merge branch 'version-13_05-branch' 2013-09-10 13:32:53 +10:00
Peter Wang
d67f1f87e9 Fix compiler abort during liveness detection.
The compiler would abort during liveness detection on an if-then-else goal
with an unreachable Then branch, due to the Then goal not having its
liveness-related fields initialised.  Bug #51.

compiler/liveness.m:
	    As above.

tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/bug51.m:
	    Add test case.

NEWS:
	    Announce the change.
2013-09-09 16:17:28 +10:00
Julien Fischer
8b73df26ee Allow repeated type variables in type class instance heads.
The Mercury compiler has long required that all of the type variables referred
to in type class instance head be distinct.  There is no particularly good
reason for this restriction -- the implication that it helps to ensure that
there are no overlapping instances in the reference manual is misleading, since
the way that we do that (at least in the C grades), by using the names of the
base_typeclass_infos, is not affected by type variables.

The major implementation detail needed to support repeated type variables in
instance declarations is that when doing context reduction, we must do full
matching of instances against constraints (i.e. we need to keep track of the
type variable bindings).  Since we already do this, the only change required to
support repeated type variables is to remove the error checking that prevents
it.

compiler/check_typeclass.m:
	Do not require that type variables in instance heads be distinct.

doc/reference_manual.texi:
	Document that repeated type variables are now allowed in instance
	heads.

NEWS:
	Announce the change.

tests/invalid/instance_dup_var.m:
	Shift this test into the valid directory.

tests/invalid/repeated_instance_vars_unsat.{m,err_exp}:
     Check that we get an error if a repeated type variable is bound
     to different types.

tests/valid/Mmakefile:
tests/invalid/Mmakefile:
	Conform to the above changes.

tests/invalid/invalid_instance_declarations.err_exp:
tests/invalid/invalid_instance_declarations.m:
	Remove instances that are now valid.
2013-07-09 15:43:48 +10:00
Peter Wang
c7ba2a81cd Replace deprecated function in test.
tests/valid/exists_cast_bug.m:
	Replace version_array.new by version_array.init.
2013-06-13 11:32:51 +10:00
Julien Fischer
4862130f84 Fix bug #183
--warn-dead-procs should not emit warnings for procedures that are foreign
exported.  However, for procedures that were foreign exported only to languages
that were *not* supported by the current backend, it did emit warnings.
This was because we only kept track of foreign_export pragmas for languages
that were supported by the current backend.  The fix is to (separately) keep
track of whether there were any foreign_export pragmas at all for a procedure.

compiler/hlds_pred.m:
	Add a new field to the proc_info structure that keeps track
	of whether the were any foreign_export pragmas for the procedure.

compiler/add_pragma.m:
	Fill in the new field.

compiler/dead_proc_elim.m:
	Only emit a warning about a procedure being dead if it is not
	the subject of any foreign_export pragmas.

	Use a more appropriate variable name in a spot.

tests/valid/Mmakefile:
tests/valid/bug183.m:
	Add a regression test for the above.
2013-05-23 10:24:51 +10:00
Peter Wang
b28e82a1d5 Make most_specific_rval handle mkword_hole.
dupelim.most_specific_rval did not handle the `mkword_hole' option that
was added to the `rval' type.

compiler/dupelim.m:
	Fix the bug.

tests/valid/Mmakefile:
tests/valid/dupelim_mkword_hole.m:
	Add test case.
2013-05-22 14:31:01 +10:00
Julien Fischer
ba0305d6c1 Fix bug #257.
Emit a warning if the variable that is the subject of a require_complete_switch
scope does not occur in the sub-goal.

compiler/det_report.m:
	As above.

tests/valid/Mmakefile:
tests/valid/bug257b.{m,exp}:
tests/warnings/Mmakefile:
tests/warnings/bug257.{m,exp}:
	Test cases for the above.
2013-05-21 12:42:21 +10:00
Paul Bone
31c0fb8291 Merge pull request #1 from PaulBone/bug271_master
Fix bug 271

This has not been reviewed but may create problems that I'm not aware of.  I'll address any review comments post-commit.

Thanks.
2013-04-15 19:32:33 -07:00
Julien Fischer
b635ebf80b Convert .cvsignore -> .gitignore files in tests directory.
tests/*/.cvsignore:
    As above.

library/.gitignore:
    Ignore files generated by the namespace cleanliness check.
2013-01-07 14:33:25 +11:00
Paul Bone
fefe868097 Add a test case for bug 271.
The bug results in a compiler crash when the compiler constructs a
typeclass info variable that it has already constructed on another branch
and there is also an existentially quantified variable present.

tests/valid/bug271.m:
tests/valid/Mmakefile:
tests/valid/Mercury.options:
    As above.
2013-01-04 14:59:34 +11:00
Zoltan Somogyi
28aeed3834 Gneerate an error message for instance definitions that specify a type
Estimated hours taken: 6
Branches: main

Gneerate an error message for instance definitions that specify a type
that is an abstract exported equivalence type.

compiler/prog_item.m:
compiler/hlds_data.m:
	Add fields to the parse tree and HLDS representations of instance
	definitions to preserve the original types they contain.

compiler/prog_io_typeclass.m:
	When creating instance definitions, duplicate the type field.

compiler/add_class.m:
compiler/make_hlds_passes.m:
	Copy the field from the parse tree to the HLDS.

compiler/equiv_type.m:
	When replacing equivalence types in instance definitions, leave
	unchanged the copies of the original types in the new field.

	This expansion is done BEFORE we construct the item list we convert
	to the HLDS. The complete erasure of the original types done by
	previous versions of the compiler is why those versions couldn't
	generate the error messages generated by this diff.

compiler/check_typeclass.m:
	Generate the error message in circumstances that call for it.
	In this error message, mention the types the user wrote, not
	the expanded types.

	Also do several kinds of cleanups.

        First, this modules does several different checks. Put the code that
        does those checks in the same order as the comment at the top
        explaining them, and the order in which they are executed.

        Second, give some predicates and variables more meaningful names.

        Third, fix the error messages so that they form complete sentences,
        and do not use abbreviations unnecessarily.

compiler/hlds_out_module.m:
	Print out the new field.

compiler/base_typeclass_info.m:
compiler/dead_proc_elim.m:
compiler/higher_order.m:
compiler/intermod.m:
compiler/mercury_to_mercury.m:
compiler/module_qual.m:
compiler/polymorphism.m:
compiler/recompilation.usage.m:
compiler/recompilation.version.m:
	Ignore the extra field, or copy it unchanged.

tests/invalid/constraint_proof_bug_lib.{m,err_exp}:
	A test case for this diff. This module is a copy of
	tests/valid/constraint_proof_bug_lib.m with cleaned-up syntax.
	This module has an instance definition for an abstract exported
	equivalence type.

tests/invalid/Mmakefile:
	Enable the new test case.

tests/invalid/bad_instance.err_exp:
tests/invalid/instance_dup_var.err_exp:
tests/invalid/instance_var_bug.err_exp:
tests/invalid/invalid_instance_declarations.err_exp:
tests/invalid/invalid_typeclass.err_exp:
	Update the expected error messages for the third cleanup change above.

tests/valid/Mmakefile:
	Disable the constraint_proof_bug test case, since its
	constraint_proof_bug_lib.m module has the bug we now test for.
	The only reason why the test case ever passed (why the bug
	was not caught at link time, as it was designed to be caught)
	is that the code in constraint_proof_bug.m that needs the bad instance
	definition is dead code, and is eliminated as such.

tests/invalid/constraint_proof_bug_lib.m:
	Adopt the cleanup from the copy in the invalid directory.
2012-06-05 15:14:29 +00:00
Julien Fischer
05ce757fdf Fix bug #241: a typo was preventing require_semidet scopes from being
Branches: main, 11.07

Fix bug #241: a typo was preventing require_semidet scopes from being
recognised.

compiler/prog_io.m;
	Fix a typo: s/require_semi/require_semidet/

tests/valid/Mmakefile:
tests/valid/require_bug.m:
	Add a test the above.
2011-12-03 13:35:16 +00:00
Peter Wang
55cf491e34 Fix bug #229. A term with an argument produced in a from_ground_term_construct
Branches: main, 11.07

Fix bug #229.  A term with an argument produced in a from_ground_term_construct
scope was not itself being marked to be constructed statically.  A side-effect
was an exception being thrown while generating a lookup switch in high-level C
grades.

compiler/mark_static_terms.m:
	Add the variable constructed in a from_ground_term_construct scope
	to the set of static variables.

tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/mark_static_bug.m:
	Add test case.
2011-11-23 07:35:07 +00:00
Julien Fischer
a60beb42e7 Make the none.gc.memprof grade work with MSVC again.
Branches: main, 11.07

Make the none.gc.memprof grade work with MSVC again.

Avoid more warnings when compiling with MSVC.

compiler/layout_out.m:
	Avoid an incomplete type in the declaration of the alloc_sites
	array.  (Similar changes need to be made for the layout structures
	related to debugging and deep profiling - I am in the process of
	testing the former, the latter doesn't currently work on Windows
	any way.)

browser/listing.m:
	Use don't-care variables in some foreign_procs.
	This avoids warnings about assignments from uninitialized
	variables with MSVC.

*/.cvsignore:
	Update cvsignore entries.

	Ignore files generated by mprof.
2011-10-20 06:37:35 +00:00
Julien Fischer
9480a49274 Change the argument order of predicates in the sparse_bitset modules to make
Branches: main

Change the argument order of predicates in the sparse_bitset modules to make
it more conducive to the use of state variable notation.

Group function clauses together with the clauses for the corresponding
predicates.

library/sparse_bitset.m:
	As above.

library/digraph.m:
compiler/make.dependencies.m:
compiler/mode_robdd.equiv_vars.m:
compiler/mode_robdd.implications.m:
compiler/mode_robdd.tfeirn.m:
tests/hard_coded/bitset_tester.m:
tests/hard_coded/pprint_test.m:
tests/valid/loop_inv_bug.m:
	Conform to the above change.

library/digraph.m:
library/getopt.m:
library/getopt_io.m:
library/map.m:
	Remove dependencies on the svset module.

NEWS:
	Announce the above change.
2011-05-19 13:11:47 +00:00
Peter Wang
d5c26db7cf Revert incorrect sanity check in unification_set_reuse.
Branches: main

compiler/structure_reuse.versions.m:
	Revert incorrect sanity check in unification_set_reuse.

tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/reuse_static2.m:
	Add test case.
2011-05-09 03:24:39 +00:00
Julien Fischer
9f68c330f0 Change the argument order of many of the predicates in the map, bimap, and
Branches: main

Change the argument order of many of the predicates in the map, bimap, and
multi_map modules so they are more conducive to the use of state variable
notation, i.e. make the order the same as in the sv* modules.

Prepare for the deprecation of the sv{bimap,map,multi_map} modules by
removing their use throughout the system.

library/bimap.m:
library/map.m:
library/multi_map.m:
	As above.
NEWS:
	Announce the change.

	Separate out the "highlights" from the "detailed listing" for
	the post-11.01 NEWS.

	Reorganise the announcement of the Unicode support.

benchmarks/*/*.m:
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
extras/*/*.m:
mdbcomp/*.m:
profiler/*.m:
tests/*/*.m:
ssdb/*.m:
samples/*/*.m
slice/*.m:
	Conform to the above change.

	Remove any dependencies on the sv{bimap,map,multi_map} modules.
2011-05-03 04:35:04 +00:00
Peter Wang
3788a9d6fb Improve Unicode support.
Branches: main

Improve Unicode support.

Declare that we use the Unicode character set, and UTF-8 or UTF-16 for the
internal string representation (depending on the backend).  User code may be
written to those assumptions.  Other external encodings can be supported in
the future by translating to/from Unicode internally.

The `char' type now represents a Unicode code point.

NOTE: questions about how to handle unpaired surrogate code points, etc. have
been left for later.


library/char.m:
        Define a `char' to be a Unicode code point and extend ranges
        appropriately.

        Add predicates: to_utf8, to_utf16, is_surrogate, is_noncharacter.

	Update some documentation.

library/io.m:
	Declare I/O predicates on text streams to read/write code points, not
	ambiguous "characters".  Text files are expected to use UTF-8 encoding.
	Supporting other encodings is for future work.

        Update the C and Erlang implementations to understand UTF-8 encoding.

	Update Java and C# implementations to read/write code points (Mercury
	char) instead of UTF-16 code units.

	Add `may_not_duplicate' attributes to some foreign_procs.

	Improve Erlang implementations of seeking and getting the stream size.

library/string.m:
	Declare the string representations, as described earlier.

        Distinguish between code units and code points everywhere.
	Existing functions and predicates which take offset and length
	arguments continue to take them in terms of code units.

        Add procedures: count_code_units, count_codepoints, codepoint_offset,
	to_code_unit_list, from_code_unit_list, index_next, unsafe_index_next,
	unsafe_prev_index, unsafe_index_code_unit, split_by_codepoint,
	left_by_codepoint, right_by_codepoint, substring_by_codepoint.

	Make index, index_det call error/1 if an illegal sequence is detected,
	as they already do for invalid offsets.

	Clarify that is_all_alpha, is_all_alnum_or_underscore,
	is_alnum_or_underscore only succeed for the ASCII characters under each
	of those categories.

        Clarify that whitespace stripping functions only strip whitespace
        characters in the ASCII range.

	Add comments about the future treatment of surrogate code points
	(not yet implemented).

	Use Mercury format implementation when necessary instead of `sprintf'.
	The %c specifier does not work for code points which require multi-byte
	representation.  The field width modifier for %s only works if the
	string contains only single-byte code points.

library/lexer.m:
        Conform to string encoding changes.

        Simplify code dealing with \uNNNN escapes now that encoding/decoding
        is handled by the string module.

library/term_io.m:
        Allow code points above 126 directly in Mercury source.

        NOTE: \x and \o codes are treated as code points by this change.

runtime/mercury_types.h:
        Redefine `MR_Char' to be `int' to hold a Unicode code point.

	`MR_String' has to be defined as a pointer to `char' instead of a
	pointer to `MR_Char'.  Some C foreign code will be affected by this
	change.

runtime/mercury_string.c:
runtime/mercury_string.h:
        Add UTF-8 helper routines and macros.

        Make hash routines conform to type changes.

compiler/c_util.m:
        Fix output_quoted_string_lang so that it correctly outputs non-ASCII
        characters for each of the target languages.

        Fix quote_char for non-ASCII characters.

compiler/elds_to_erlang.m:
        Write out code points above 126 normally instead of using escape
        syntax.

        Conform to string encoding changes.

compiler/mlds_to_cs.m:
        Change Mercury `char' to be represented by C# `int'.

compiler/mlds_to_java.m:
        Change Mercury `char' to be represented by Java `int'.

doc/reference_manual.texi:
        Uncomment description of \u and \U escapes in string literals.

        Update description of C# and Java representations for Mercury `char'
	which are now `int'.

tests/debugger/tailrec1.m:
        Conform to renaming.

tests/general/string_replace.exp:
tests/general/string_replace.m:
	Test non-ASCII characters to string.replace.

tests/general/string_test.exp:
tests/general/string_test.m:
	Test non-ASCII characters to string.duplicate_char,
	string.pad_right, string.pad_left, string.format_table.

tests/hard_coded/char_unicode.exp:
tests/hard_coded/char_unicode.m:
	Add test for new procedures in `char' module.

tests/hard_coded/contains_char_2.m:
	Test non-ASCII characters to string.contains_char.

tests/hard_coded/nonascii.exp:
tests/hard_coded/nonascii.m:
tests/hard_coded/nonascii_gen.c:
        Add code points above 255 to this test case.

	Change test data encoding to UTF-8.

tests/hard_coded/string_class.exp:
tests/hard_coded/string_class.m:
	Add test case for string.is_alpha, etc.

tests/hard_coded/string_codepoint.exp:
tests/hard_coded/string_codepoint.exp2:
tests/hard_coded/string_codepoint.m:
	Add test case for new string procedures dealing with code points.

tests/hard_coded/string_first_char.exp:
tests/hard_coded/string_first_char.m:
	Add test case for all modes of string.first_char.

tests/hard_coded/string_hash.m:
	Don't use buggy random.random/5 predicate which can overflow on
	a large range (such as the range of code points).

tests/hard_coded/string_presuffix.exp:
tests/hard_coded/string_presuffix.m:
	Add test case for string.prefix, string.suffix, etc.

tests/hard_coded/string_set_char.m:
	Test non-ASCII characters to string.set_char.

tests/hard_coded/string_strip.exp:
tests/hard_coded/string_strip.m:
	Test non-ASCII characters to string stripping procedures.

tests/hard_coded/string_sub_string_search.m:
	Test non-ASCII characters to string.sub_string_search.

tests/hard_coded/unicode_test.exp:
        Update expected output due to change of behaviour of
        `string.to_char_list'.

tests/hard_coded/unicode_test.m:
	Test non-ASCII character in separator string argument to
	string.join_list.

tests/hard_coded/utf8_io.exp:
tests/hard_coded/utf8_io.m:
	Add tests for UTF-8 I/O.

tests/hard_coded/words_separator.exp:
tests/hard_coded/words_separator.m:
        Add test case for `string.words_separator'.

tests/hard_coded/Mmakefile:
	Add new test cases.

	Make special_char test case run on all backends.

tests/hard_coded/special_char.exp:
tests/valid/mercury_java_parser_follow_code_bug.m:
	Reencode these files in UTF-8.

NEWS:
	Add a news entry.
2011-04-04 07:10:42 +00:00
Julien Fischer
d22a367f22 Fix another aspect of bug #190: equivalence types in solver type
Branches: main, 11.01

Fix another aspect of bug #190: equivalence types in solver type
constraint_store attributes were not being expanded.

compiler/equiv_type.m:
	Expand equivalence types in solver type constraint_store
	attributes.

tests/valid/bug190.m:
	Extend this test case to check that the above occurs.
2011-03-18 04:08:13 +00:00
Julien Fischer
9e893f139e Fix bug #190 - mutable definitions attached to the constraint_store attributes
Branches: main, 11.01

Fix bug #190 - mutable definitions attached to the constraint_store attributes
of solver type definitions were not being module qualified.

compiler/module_qual.m:
	Do module qualification on the mutable items attached to a solver
	type's constraint_store attribute as we do for normal mutable items.

	Factor out the code used to module qualify the contents of
	item_mutable_info/0 structures into a separate predicate for use
	by the above.

tests/valid/Mmakefile:
tests/valid/bug190.m:
	Regression test for the above.
2011-03-17 05:36:44 +00:00
Paul Bone
0898b5422d Add --allow-stubs and --no-warn-stubs to the command line options for the
bug180 testcase.

valid/tests/Mercury.options:
    As above.
2011-02-16 06:36:46 +00:00
Paul Bone
875054422c Fix bug180.
Branches: main 11.01

Fix bug180.

bug180's symptom was a crash in the code generator when compiling ssdb/ssdb.m
with inlining in a deep-profiling grade.

The pre-profiling simplify transformation can introduce new variables and did
not update the varset in the proc_info structure, but did add new entries to
the vartypes map.  Then when the deep-profiling transformation executes it
allocates it's own new variables using an old varset, causing it to clobber
existing entries in the vartypes array.  This means that variables created by
the simplification transformation that are referenced by goals are now
clobbered by the deep-profiler variables

tests/valid/bug180.m:
tests/valid/Mmakefile:
tests/valid/Mercury.options:
    Add a regression test for bug180 to the test suite.

compiler/simplify.m:
    Fix bug180 by always updating the proc_info's varset.

compiler/deep_profiling.m:
    Use svmap.det_insert rather than svmap.set to detect these types of errors
    earlier.

compiler/handle_options.m:
    Add a new dump hlds alias to help debug variable-related problems.
2011-02-06 07:30:05 +00:00
Peter Wang
fd76da59ff Add support for the csharp' grade to mmc --make', and make it possible to
Branches: main

Add support for the `csharp' grade to `mmc --make', and make it possible to
install the `csharp' grade with `mmake install'.

Also some miscellaneous fixes.


configure.in:
        Require a recent enough bootstrap compiler that recognises C# as a
        language for `pragma foreign_type'.

Mmakefile:
        Use `mmc --make' to install the standard library in csharp grade.

aclocal.m4:
        Search for the Mono C# compiler `gmcs', which is required for generics
        at this time.  Prefer it over the DotGNU C# compiler, which I have not
        tested.

        Search for `mono'.  If found, it will be used in shell scripts to
        launch executables generated via the csharp backend.

        Remove "MS_" prefixes on the variables MS_CSC and MS_ILASM, which are
        not Microsoft-specific.  More importantly, it should be less likely to
        make the mistake of adding an extra underscore to CSCFLAGS and
        ILASMFLAGS.

README.DotNet:
        Conform to variable renamings.

compiler/compile_target_code.m:
        Add new linked target types `csharp_executable', `java_launcher' and
        `erlang_launcher', instead of overloading `executable'.

        Link with `mer_std.dll' and other libraries when generating C#
        executables.  There is no `mer_rt.dll'.

        Pass "/debug" to the C# compiler if `--target-debug' is set.

        Create a shell script to launch the executable if necessary.

        Delete an unused predicate `standard_library_directory_option'.

compiler/file_names.m:
        `.cs' and `.cs_date' are grade-dependent.

compiler/handle_options.m:
        Force `.exe' as the executable file extension in csharp grades.

        Make the `erlang' grade component imply the same options as MLDS
        grades.

compiler/make.m:
        Classify executable target types based on the compilation target.

compiler/make.module_target.m:
        Handle `mmc --grade csharp --make <target>.dll'.

compiler/make.program_target.m:
        Install library DLLs in csharp grades.

        Make clean targets remove files for csharp grades.

        Conform to changes.

compiler/make.util.m:
        Add a stub foreign type.

        Conform to changes.

compiler/module_cmds.m:
        Factor out code to generate the shell scripts which launch programs
        compiled in Java, Erlang and C# grades.

compiler/options.m:
        Add `cli_interpreter' option to remember the name of the program which
        should be used to run CLI (.NET) programs.

        Add C#-related options to the help message.

compiler/options_file.m:
        Remove "MS_" prefixes on MS_ILASM_FLAGS and MS_CSC_FLAGS, and remove
        the extra underscore before "FLAGS".  In all uses of the variables,
        they were spelt without the extra underscore.

doc/user_guide.texi:
        Document options and file types related to the C# grade.

library/Mmakefile:
        Pass `mercury_dotnet.cs' to the C# compiler when building the standard
        library.  Suppress some warnings.

        Allow stubs in this directory for csharp grade.

        Conform to variable renamings.

library/builtin.m:
        Uncomment foreign language pragmas for C#.

        Handle null values in C# implementation of `deep_copy'.

library/private_builtin.m:
library/string.m:
        Compare strings by ordinals in C#, instead of culture-specific rules.
        Although the latter is allowed according to the documentation, it is
        likely to slower, and cause confusion when porting between backends.

        Handle negative index in string.set_char.

library/rtti_implementation.m:
        Uncomment foreign language pragmas for C#.

        `System.Type.GetType' only searches the current executing assembly or
        in mscorlib for a type.  As we have to be able to find types in other
        assemblies (e.g. mer_std.dll or user DLLs), explicitly search through
        a list of assemblies.

library/thread.semaphore.m:
        Uncomment foreign language pragmas for C#.

        Fix missing class qualification.

library/array.m:
library/bitmap.m:
library/bool.m:
library/dir.m:
library/exception.m:
library/io.m:
library/mutvar.m:
library/par_builtin.m:
library/region_builtin.m:
library/store.m:
library/thread.m:
library/time.m:
library/univ.m:
library/version_array.m:
        Uncomment foreign language pragmas for C#.

mdbcomp/rtti_access.m:
        Add type and procedure stubs.

runtime/mercury_dotnet.cs.in:
        Override `Equals(object)' methods in `TypeCtorInfo_Struct' and
        `TypeInfo_Struct' classes.  This requires we override `GetHashCode' as
        well.

        Handle nulls arguments to `Equals' methods as is the expected behaviour.

        Override `ToString' in `TypeCtorInfo_Struct' to produce more useful
        output during debugging.

scripts/Mercury.config.in:
        Record the configured CLI_INTERPRETER and pass that to the compiler as
        a flag.

        Conform to variable renamings.

scripts/Mmake.vars.in:
        Pass value of CSCFLAGS from Mmake through to `mmc --make'.

        Conform to variable renamings.

scripts/Mercury.config.bootstrap.in:
scripts/Mmake.rules:
        Conform to variable renaming.

scripts/canonical_grade.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
        Canonicalise high-level code, high-level-data, C# target code to the
        `csharp' grade.

        Handle erlang grades like other grades.

scripts/prepare_install_dir.in:
        Copy `.cs' files from the runtime directory when preparing an install
        directory.

browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
trace/Mmakefile:
        Do as other non-C grades in this directory.

        Conform to variable renamings.

tests/hard_coded/foreign_enum_dummy.m:
tests/hard_coded/sub-modules/non_word_mutable.m:
tests/hard_coded/sub-modules/sm_exp_bug.m:
        Make these tests work in C#.

tests/mmc_make/Mmakefile:
        Update a regular expression to account for `mmc --make' writing
        "Making rebuild.exe" on platforms where the .exe suffix is not normally
        used.

tests/mmc_make/complex_test.exp2:
        Add alternative output (minor difference in floating point precision).

tests/debugger/Mmakefile:
tests/debugger/declarative/Mmakefile:
tests/general/structure_reuse/Mmakefile:
tests/hard_coded/Mmakefile:
tests/hard_coded/sub-modules/Mmakefile:
tests/par_conj/Mmakefile:
tests/stm/Mmakefile:
        Disable some tests in the csharp grade.

tests/invalid/Mmakefile:
        Disable some tests in the csharp grade.

        Enable a test which should work in java grades.

tests/valid/Mmakefile:
        Do as other non-C grades in this directory.

        When testing the csharp grade in this directory, produce only the C#
        target files for now.

tests/run_one_test:
        Don't compress a failing test case executable when the executable is
        actually only a shell script.
2010-09-30 07:23:36 +00:00
Zoltan Somogyi
6e336e38f6 Fix Mantis bug #128.
Estimated hours taken: 4
Branches: main

Fix Mantis bug #128.

compiler/loop_inv.m:
	Fix the bug. The bug was that the loop invariants pass considered
	the unification that constructed a partially instantiated term
	to be an invariant goal, and attempted to hoist it out of its
	predicate. Due to the free variable inside the term, this yielded
	a compiler abort.

	Improve the names of predicates and types.

tests/valid/bug128.m:
	Add the regression test for this bug.

tests/valid/Mmakefile:
tests/valid/Mercury.options:
	Enable the test case.
2010-09-15 02:29:01 +00:00
Zoltan Somogyi
58648719b0 Fix Mantis bug #159.
Estimated hours taken: 4
Branches: main

Fix Mantis bug #159.

compiler/modecheck_goal.m:
compiler/unique_modes.m:
	Fix two occurrences of the same bug. The bug was both plain mode
	checking and unique mode checking, when processing from_ground_term
	scopes, neglected to test whether the variable being constructed was
	live or not, and thus did not delete the scope in cases where it was
	not live, even though they both delete construction unifications in
	such circumstances.

compiler/modecheck_unify.m:
compiler/simplify.m:
	Improve the code style.

tests/valid/bug159.m:
	Add the regression test for this bug.

tests/valid/Mmakefile:
tests/valid/Mercury.options:
	Enable the test case.
2010-09-14 09:08:32 +00:00
Zoltan Somogyi
e747987afb Fix Mantis bug #109.
Estimated hours taken: 3
Branches: main

Fix Mantis bug #109.

compiler/add_heap_ops.m:
	Fix the bug. The bug was that this pass tried to record the heap
	pointer at the start of the nth disjunct, even in cases where
	there were no following disjuncts at whose starts that saved
	heap pointer could be restored (to recover the memory allocated
	by the nth disjunct). The symptom was a disjunction with only
	one disjunct, but the problem was a simple semantic one. The fix
	is simply to say that we won't record the heap pointer before the nth
	disjunct unless disjunct n+1 exists.

	Improve the generated HLDS in another way as well: wrap the appropriate
	kind of promise_purity scope around the transformed code (which uses
	impure primitives).

tests/valid/bug109.m:
	Add the regression test for this bug.

tests/valid/Mmakefile:
tests/valid/Mercury.options:
	Enable the test case.
2010-09-14 02:22:56 +00:00
Julien Fischer
f4139d8d69 Remove support for the old C interface. The parser still recognises the old
pragmas but it now emits an error message saying what pragma in the "new"
foreign language interface to use instead.  (That will be deleted after the
next release.)

Remove support for nondet foreign code from the implementation.

Add some bits from the old C interface chapter of the reference manual,
about linking with C object files and the c_pointer type, to the chapter
on the foreign language interface; delete the rest.

Add an illustration of simulating nondet foreign code with Mercury clauses
and (semi)deterministic foreign_procs.

doc/reference_manual.texi:
	Delete the old C interface chapter.

	Add a section on linking against C object files to the C specific
	section of the foreign language interface chapter.  (The old version of
	this was quite mmake-specific, the new version attempts to minimise
	this.)

	Mention the c_pointer type in section on C foreign types.

	Mention that nondet foreign_procs are not allowed.  Give an example
	to use foreign code and nondeterminism.

compiler/prog_io_pragma.m:
	Emit error messages when any of the pragmas used by the old C interface
	are encountered.

compiler/prog_item.m:
	Delete the parse tree representation of import pragmas.

compiler/gcc.m:
	Replace `:- pragma import' declarations with `:- pragma foreign_proc'
	declarations for C.

compiler/add_heap_ops.m:
compiler/add_trail_ops.m:
compiler/add_pragma.m:
compiler/deep_profiling.m:
compiler/det_analysis.m:
compiler/equiv_type.m:
compiler/erl_call_gen.m:
compiler/foreign.m:
compiler/goal_util.m:
compiler/hlds_out_goal.m:
compiler/make_hlds_passes.m:
compiler/make_hlds_warn.m:
compiler/mercury_to_mercury.m
compiler/ml_code_gen.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/polymorphism.m:
compiler/pragma_c_gen.m:
compiler/proc_gen.m:
compiler/prog_data.m:
compiler/recompilation.version.m:
	Delete stuff related the old C interface.

tests/hard_coded_Mmakefile:
tests/hard_coded/inline_nondet_pragma_c.*:
tests/hard_coded/nondet_c.*:
tests/hard_coded/nondet_pragma_c_bug.*:
tests/hard_coded/pragma_import.*:
	Delete these tests.  The features they exercise are no longer
	supported.

tests/*/*.m:
	Replace uses of the old C interface with the new.
2010-09-10 05:15:05 +00:00
Peter Wang
de7c7d3186 Fix a regression introduced on 2009-06-11 in the change
Branches: main, 10.04

Fix a regression introduced on 2009-06-11 in the change
"Include the type_ctor in cons_ids for user-defined types."

The symptom was an abort in the low-level C code generator when compiling
a call to an implied mode, where the implied argument is of a no-tag type.
The bug below messed up the liveness computation.

compiler/mode_util.m:
        Use `equivalent_cons_ids' to compare a cons_id-for-a-type with a
        cons_id-for-an-inst as the latter may have a dummy type_ctor field.

tests/valid/Mmakefile:
tests/valid/implied_mode_no_tag.m:
        Add test case.
2010-08-18 00:58:55 +00:00
Julien Fischer
8c82c3cce2 Delete predicates from the standard library that were deprecated in Mercury
version 0.13.  (All of the following are still supported in version 10.04.)

library/io.m:
	Delete predicates that were marked as obsolete in version 0.13.

	Delete the binary_stream/1 type class and it's instances.
	They are no longer needed (and were only ever required to supported
	predicates that were deprecated.)

library/bitmap.m:
library/version_bitmap.m:
	Delete the obsolete get/2 predicates.

library/store.m:
	Delete an empty interface section.

library/term_to_xml.m:
	Delete obsolete predicates.

library/bintree.m:
library/bintree_set.m:
	Delete the contents of these modules - I haven't deleted the files
	themselves in case we wish to re-use them.

library/library.m:
	Remove the bintree* modules from the stdlib.

doc/Mmakefile:
	Ignore the bintree*.m files when generating the library guide.

tests/valid/lazy_list.m:
	Don't import bintree_set (and a couple of other unused modules).
2010-07-30 13:16:48 +00:00
Peter Wang
24322faabc Work around bug #142. The symptom is an assertion failure in
Branches: main, 10.04

Work around bug #142.  The symptom is an assertion failure in
hlds.hlds_rtti.apply_substs_to_constraint_map.  It occurs when:

- a variable holding a typeclass_info is used multiple times in a call;
- the called procedure is inlined into the caller;
- the corresponding head variables have class constraints with functional
  dependencies;
- the type variables in those constraints should be unified, but type variables
  in the ranges of functional dependencies are not unified;
- a single typeclass_info variable ends up being for two different constraints.

The work around adopted here is to prevent inlining of a call when a single
typeclass_info variable appears multiple times in the argument list, for which
the head variables have differing class constraints.

compiler/inlining.m:
        As above.

tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/bug142.m:
        Add test case.
2010-05-10 05:02:27 +00:00
Peter Wang
c053f90088 Allow inlining of Java foreign_procs.
Branches: main, 10.04

Allow inlining of Java foreign_procs.

This revealed a problem with directly using the `succeeded' flag directly as
the success indicator in Java foreign_procs.  When the code of the foreign_proc
becomes a nested function, and after nested functions are eliminated, there may
not be a variable called `succeeded' in that context; it is moved into
environment struct, and the transformation is not able to update handwritten
code to reflect that.  The solution is to declare a local variable for the
foreign_proc, let the handwritten code assign that, then assign its final
value to the `succeeded' flag with an MLDS statement.

We take the opportunity to name the local variable `SUCCESS_INDICATOR', in
line with other backends.

compiler/inlining.m:
        Allow inlining of Java foreign_procs.

compiler/ml_foreign_proc_gen.m:
        In the code generated for semidet Java foreign_procs, declare a local
        `SUCCESS_INDICATOR' variable and assign its value to the `succeeded'
        flag afterwards.

        Add braces to give the foreign_proc variables a limited scope.

compiler/make_hlds_warn.m:
        Conform to renaming.

doc/reference_manual.texi:
        Update documentation for the renaming of the `succeeded' variable.

library/array.m:
library/bitmap.m:
library/builtin.m:
library/char.m:
library/construct.m:
library/dir.m:
library/exception.m:
library/float.m:
library/int.m:
library/io.m:
library/math.m:
library/private_builtin.m:
library/rtti_implementation.m:
library/string.m:
library/thread.m:
library/time.m:
library/type_desc.m:
library/version_array.m:
        Conform to renaming.

        Fix problems with Java foreign_procs that may now be copied into other
        modules when intermodule optimisation is enabled, some by disallowing
        the procedures from being duplicated, some by making referenced
        classes/fields `public'.

        [Some of the `may_not_duplicate' attributes may not indicate actual
        problems, just that it seems not worthwhile inlining calls to the
        procedure.]

extras/solver_types/library/any_array.m:
tests/hard_coded/equality_pred_which_requires_boxing.m:
tests/hard_coded/external_unification_pred.m:
tests/hard_coded/java_test.m:
tests/hard_coded/redoip_clobber.m:
tests/hard_coded/user_compare.m:
tests/valid/exported_foreign_type2.m:
tests/warnings/warn_succ_ind.m:
tests/warnings/warn_succ_ind.exp3:
        Conform to renaming.
2010-05-07 03:12:27 +00:00
Peter Wang
6da00693c5 Fix a problem where recomputing the instmap_delta over a negation
Branches: main, 10.04

compiler/mode_util.m:
        Fix a problem where recomputing the instmap_delta over a negation
        goal would change its reachability from `unreachable' to `reachable'.

tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/neg_erroneous.m:
        Add test case.
2010-04-23 04:07:18 +00:00
Julien Fischer
eb2f9b1147 More test case fixes in the valid tests.
Branches: main, 10.04

More test case fixes in the valid tests.

tests/valid/Mercury.options:
	Compile a bunch of tests that force either the grade (or a component
	thereof) with --no-intermodule-optimization, since the necessary .opt
	files may not exist if the grade is not installed.  (None of the tests
	is checking for something that will be masked by
	--no-intermodule-optimization.)
2010-03-11 07:18:08 +00:00
Julien Fischer
cb4725cf84 Fix three failures in the valid tests.
Branches: main, 10.04

Fix three failures in the valid tests.

tests/valid/Mercury.options:
	The tests liveness_ite, livevars_shallow, and livevars_shallow2
	all force the grade to be set to "none".
	Disable --intermodule-optimization for these tests, otherwise the
	compiler halts with an error when it cannot find the .opt files
	in grade none.
2010-03-11 06:29:56 +00:00
Zoltan Somogyi
653be035b3 Fix Mantis bug #134.
Estimated hours taken: 0.5
Branches: main

Fix Mantis bug #134.

compiler/ml_disj_gen.m:
	If the options specify --no-static-ground-terms, do not try to
	generate lookup tables for disjunctions; the trying would lead
	to a compiler abort (bug 134), and we cannot generate the table
	anyway.

tests/valid/bug134.m:
tests/valid/Mmakefile:
tests/valid/Mercury.options:
	Add the test case for this bug.
2010-03-04 01:13:39 +00:00
Julien Fischer
f4bf5593f7 Fix bug #100. The compiler is erroneously reporting an import in a module
interface as unused even though the import is required in order to satisfy the
superclass constraints on an exported type class instance.  (The situation
is explained in detail in the diff.)

The fix is to assume that when checking for unused modules, an imported module
that provides a type class instance is used.  We can (and do) avoid this
assumption if the importing module does not export any type class instances
since in that case the erroneous warning cannot occur.

compiler/module_qual.m:
	Keep tracking of which imported modules export type class instances
	and whether the current module exports any.

	Using the above information, avoid incorrectly reporting modules
	imported in the interface as unused if they are in fact required
	because of superclass constraints on instances.
	(This is somewhat inelegant, but alternative fixes would require
	either (a) delaying the unused module check until after the HLDS
	has been constructed, or (b) doing more work on the parse tree
	to make information about type class and instances available.
	Both of these are much larger changes.)

tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/bug100*.m:
	Regression test for bug 100.

tests/warnings/Mmakefile:
tests/warnings/unused_interface_import*.m:
tests/warnings/unused_interface_import.exp:
	Check that we still emit a warning about unused modules
	that export instances if the module compiled does _not_
	export any instances.
2010-02-02 05:20:27 +00:00