Commit Graph

17 Commits

Author SHA1 Message Date
Zoltan Somogyi
3fb55722be Print structured terms on one line if they fit.
The compiler's diagnostic outputs often contain terms, representing
either terms in the program, or other entities such as types or modes.
These can be printed either as

    f(a, b)

or as

    f(
        a,
        b
    )

We usually want the former if the term fits on one line, but the latter
if it is too big to fit on one line. The problem is that the code
generating the diagnostic often does not know what fits on one line.

compiler/error_spec.m:
    This diff adds two new format pieces that respectively stand for
    each half of a matched pair of left and right parentheses.
    The idea is that these can be printed

    - either with a newline, and an indent increment, after the left paren,
      and an indent decrement, and a newline, before the right paren,
      and with all newlines being honored between them,
    - or with no newline after the left paren or before the right paren,
      and all newlines between them being replaced by spaces.

compiler/write_error_spec.m:
    Implement the new format pieces, using the one-line format above
    if the term fits in the space available, or the multi-line format
    if it does not.

compiler/error_type_util.m:
    Use the new mechanism to represent the structure of types.

    Delete an old piece of code that had the same objective,
    but was much cruder and less effective.

tests/invalid/actual_expected.err_exp:
tests/invalid/ext_type_bug.err_exp:
tests/invalid/fbnf.err_exp:
tests/invalid/ho_type_arity_bug.err_exp:
tests/invalid/overloading.err_exp:
tests/invalid/type_diff.err_exp:
    Expect more compact representations of the structure of types.

tests/invalid/type_error_ambiguous.err_exp:
    Expect a different ordering of the same information.
    The difference is due to the changed internal representation
    (in terms of format_pieces) of a type.
2022-10-14 19:13:38 +11:00
Zoltan Somogyi
bc1bf0470f Get type_to_pieces to generate structured output.
compiler/error_util.m:
    Rewrite the type_to_pieces function, which typecheck_errors.m uses
    to format types in error messages, in order to fix five problems.

    The first two problems were with formatting higher order types.
    First, if a higher order type included an existentially quantified
    type variable, that quantification was *not* printed around the
    higher order type. Second, that quantification *was* printed around
    the type of every (non-higher-order) argument of the higher order value.
    The only reason why this has not been a problem so far is that
    we have no test case that contains a higher order type with an
    existentially quantified type variable :-(

    The fix to both these problems is to always put the existential
    quantification of any such type variables at the top level, regardless
    of the kind of type the quantification ranges over, and to never print
    any quantification of any of its component types.

    The third problem was that non-higher-order types were output in a
    non-structured fashion. (The special-case code we used to format
    higher order types did already output *them* in a structured fashion,
    though only at the top level.) We did this by converting (unparsing)
    the type to a term, and then calling mercury_term_to_string.

    Generating structured output by replacing only the mercury_term_to_string
    part would not worked well; most of the code would have been devoted
    to working out what kind of type the given term was representing.
    Therefore this diff changes the approach to formatting types without
    converting them to a term. The output we generate for each type
    uses indentation levels to show the type's structure, but for
    types whose formatted form is sufficiently short, we delete all
    the newlines from that representation.

    The fourth problem was while most of the existing code took care
    to treat function names as unbreakable, one part of it did not,
    which caused the name of a field update function, "f1 :=",
    to be split across two lines. This diff fixes that bug as well.

    A fifth problem, pointed out by Peter, was that we were printing
    arity-0 functions as "func" instead of as "(func)", even though
    Mercury syntax for types demands the latter.

    An arguable sixth problem was that we formatted existential
    quantifications as
        (some [Vars] Type)
    We now format that as
        some [Vars] (Type)

    Change the order of the arguments of type_to_pieces to reduce
    the difference between it and type_pieces, its internal version,
    which we use to format types that do not need existential quantification.

    Export the function that filters newlines out of lists of format
    components, since other parts of the compiler may also need it
    in the future.

    Fix two occurrences of a bug that is totally unrelated to the above:
    list_to_pieces and strict_list_to_pieces treated the last element
    in their input list differently from all the other elements.

compiler/parse_tree_out_term.m:
    Add a utility function for use by new code in error_util.m.

compiler/typecheck_errors.m:
    Conform to the new argument order of type_to_pieces.

tests/invalid/actual_expected.err_exp:
tests/invalid/bug197.err_exp:
tests/invalid/ext_type.err_exp:
tests/invalid/ext_type_bug.err_exp:
tests/invalid/foreign_procs_exist_type.err_exp:
tests/invalid/higher_order_mode_mismatch.err_exp:
tests/invalid/ho_type_arity_bug.err_exp:
tests/invalid/no_method.err_exp:
tests/invalid/nullary_ho_func_error.err_exp:
tests/invalid/overloading.err_exp:
tests/invalid/type_error_ambiguous.err_exp:
tests/invalid/type_mismatch.err_exp:
tests/invalid/types2.err_exp:
tests/invalid/user_field_access_decl_override2.err_exp:
tests/invalid_purity/impure_func_t5.err_exp:
tests/invalid_purity/impure_pred_t1.err_exp:
tests/invalid_purity/impure_pred_t1_fixed.err_exp:
tests/invalid_purity/impure_pred_t2.err_exp:
    Expect types in error messages in their updated format.
2022-02-21 17:56:52 +11:00
Zoltan Somogyi
29ff7d5732 Improve diagnostics for type- and mode-errors.
compiler/mode_errors.m:
    When generating an error message for a bad higher order inst,
    print the specific cause of the mismatch, instead of just
    "actual inst is X, expected inst was Y".

compiler/modecheck_call.m:
    Change the code that generates that error to record the specific cause
    in the mode_error structure of the error.

tests/invalid/higher_order_mode_mismatch.{m,err_exp}:
    Add a new test case for the specific causes that other test cases
    don't already cover. (As it happens, most of those causes can't be
    caught by mode analysis because typechecking reports them first,
    but it did so in ways that could be improved. Hence the change to
    typecheck_errors.m and most of the .err_exp files below.)

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

compiler/typecheck_errors.m:
    Instead of generating output of the form

        <something> has type `abc',
        expected type was `def'

    generate output of the form

        <something> has type
            abc,
        expected type was
            def

    The indentation directs the eye to the differences that matter,
    and automatically lines up any corresponding parts of the actual
    and expected types. It also replaces the quotes as a method
    of separating the types being referred to from their surroundings.

tests/invalid/abstract_eqv.err_exp:
tests/invalid/actual_expected.err_exp:
tests/invalid/anys_in_negated_contexts.err_exp:
tests/invalid/arg_permutation.err_exp:
tests/invalid/bad_statevar_bad_context.err_exp:
tests/invalid/bug197.err_exp:
tests/invalid/comparison.err_exp:
tests/invalid/error_in_list.err_exp:
tests/invalid/ext_type.err_exp:
tests/invalid/ext_type_bug.err_exp:
tests/invalid/foreign_procs_exist_type.err_exp:
tests/invalid/getopt_old.err_exp:
tests/invalid/ho_type_arity_bug.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
tests/invalid/illtyped_compare.err_exp:
tests/invalid/integral_constant_no_suffix.err_exp:
tests/invalid/method_impl.err_exp:
tests/invalid/mixed_up_streams.err_exp:
tests/invalid/mpj1.err_exp:
tests/invalid/mpj4.err_exp:
tests/invalid/no_method.err_exp:
tests/invalid/nullary_ho_func_error.err_exp:
tests/invalid/overloading.err_exp:
tests/invalid/record_syntax_errors.err_exp:
tests/invalid/try_bad_params.err_exp:
tests/invalid/type_error_ambiguous.err_exp:
tests/invalid/type_error_in_arg.err_exp:
tests/invalid/type_mismatch.err_exp:
tests/invalid/types2.err_exp:
tests/invalid/user_field_access_decl_override2.err_exp:
tests/invalid_nodepend/errors2.err_exp:
tests/invalid_purity/impure_func_t5.err_exp:
tests/invalid_purity/impure_pred_t1.err_exp:
tests/invalid_purity/impure_pred_t1_fixed.err_exp:
tests/invalid_purity/impure_pred_t2.err_exp:
tests/invalid_purity/purity_nonsense2.err_exp:
tests/invalid_purity/purity_type_error.err_exp:
    Expect the updated error messages.

tests/invalid/ho_type_mode_bug.m:
    Update obsolete comments.
2022-02-19 00:03:45 +11:00
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
5a639e1656 Quote cons_ids consistently in error messages.
compiler/error_util.m:
    Add a format piece for identifying cons_ids.

compiler/hlds_out_util.m:
compiler/prog_out.m:
    Add a version of the predicate that convert cons_ids to string
    that quotes appropriately for error messages.

    Move this predicate, and some existing predicates for converting
    cons_ids to strings from hlds_out_util.m to prog_out.m, so that
    error_util.m, which is part of the parse_tree.m package, can use them.
    Since cons_ids are defined in prog_data, a part of parse_tree, they
    should always have been here.

    Make the same move for some other predicates that also convert to strings
    values of other types defined in prog_data.m.

compiler/prog_mode.m:
compiler/prog_util.m:
    Move a predicate dealing with cons_ids from prog_mode.m to prog_out.m,
    since prog_out needs it now.

compiler/det_report.m:
compiler/post_typecheck.m:
    Use the new format piece where relevant.

compiler/typecheck_errors.m:
    Use the new format piece where relevant.

    Avoid prevarication about singular vs plural when not necessary.

tests/compiler/*.m:
    Conform to the above.

tests/invalid/*.err_exp:
    Update these to expect the new error messages.
2015-01-31 20:39:19 +11:00
Zoltan Somogyi
5e656fc115 Improve messages for errors in functor argument types.
compiler/typecheck_errors.m:
    Given a type error in X = f(Y1, ..., Yn), where the type of one or more
    of the Yi does not match the type of the corresponding argument of f,
    we have for a long time tried to print error messages that mention
    the expected/actual type mismatches only for those arguments.
    However, we used to insist on both the expected and actual types
    being uniquely known. This diff lifts that restriction, so we can
    now generate these more focused messages if e.g. the Yi is "no",
    whose type may be either bool or maybe(T).

    We now also try to suppress any mention of mismatches in which the actual
    type subsumes the expected type. This usually happens when the actual
    argument value is something like [], whose type is list(T), but the
    expected type is a list with a known element type. If there are any
    argument type mismatches for which this is not true, we print error
    messages only about them.

    Don't insist on printing the entire right hand side term on a single
    like as a fixed quoted string. For the kinds of unifications for which
    this improvement is most useful, that term won't fit on one line.

    Be more consistent aboiut putting quotes around types in error messages.

    Move a predicate next to where it is used.

compiler/prog_type.m:
    Provide a missing utility function for the new code in typecheck_errors.m.

tests/invalid/overloading.err_exp:
    Expect the error messages we now generate for this test case.
    This is only 10 lines, compared to the old 44 lines. The first 6
    of those 10 set the context, and the last 4 identify the problem
    exactly. (The motivation for this change was an error like this.)

tests/invalid/type_error_ambiguous.err_exp:
    Expect quotes around types.
2014-12-27 13:19:06 +11: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
Julien Fischer
c1b0fdc047 Fix a couple of issues with some of the set types in the standard library
Branches: main, 11.01

Fix a couple of issues with some of the set types in the standard library
being used in type class instances.

library/set_unordlist.m:
	Define set_unordlists using a notag type rather than an equivalence.
	This allows them to be safely used in type class instances.

library/set.m:
	Export the definition of the type set/1 in an undocumented interface
	section.  Not exporting it leads to problems when it used used in
	type class instances (since it is defined using an abstract
	equivalence).  We don't want to use a notag wrapper here since that
	would lead to some operations, e.g. power_union/2, being less efficient.
	This should be ok; the abstraction barrier is still in place  since set/1
	is defined to be set_ordlist/1 (which is itself abstract).

tests/invalid/actual_expected.err_exp:
tests/invalid/overloading.err_exp:
	Conform to the above changes.
2011-02-16 02:11:50 +00:00
Peter Wang
d9e30aec5b Don't write an outer pair of brackets when formatting terms with '.'
Branches: main

compiler/mercury_to_mercury.m:
	Don't write an outer pair of brackets when formatting terms with '.'
	or ':' as the functor, which made module-qualified types in error
	messages unnecessarily ugly.

tests/hard_coded/impl_def_literal.exp:
tests/invalid/actual_expected.err_exp:
tests/invalid/bad_instance.err_exp:
tests/invalid/errors2.err_exp:
tests/invalid/ext_type.err_exp:
tests/invalid/ext_type_bug.err_exp:
tests/invalid/funcs_as_preds.err_exp:
tests/invalid/illtyped_compare.err_exp:
tests/invalid/instance_dup_var.err_exp:
tests/invalid/invalid_instance_declarations.err_exp:
tests/invalid/method_impl.err_exp:
tests/invalid/mixed_up_streams.err_exp:
tests/invalid/mpj4.err_exp:
tests/invalid/nullary_ho_func_error.err_exp:
tests/invalid/overloading.err_exp:
tests/invalid/purity/impure_func_t5.err_exp:
tests/invalid/purity/impure_pred_t1.err_exp:
tests/invalid/purity/impure_pred_t1_fixed.err_exp:
tests/invalid/purity/impure_pred_t2.err_exp:
tests/invalid/record_syntax_errors.err_exp:
tests/invalid/tc_err1.err_exp:
tests/invalid/tc_err2.err_exp:
tests/invalid/try_bad_params.err_exp:
tests/invalid/type_error_ambiguous.err_exp:
tests/misc_tests/pretty_print_test.exp:
tests/warnings/inference_test.exp:
	Update test cases.
2009-04-16 02:09:09 +00:00
Zoltan Somogyi
5eee81204e A big step towards cleaning up the way we handle errors.
Estimated hours taken: 28
Branches: main

A big step towards cleaning up the way we handle errors. The main changes are

- the provision, in error_util.m, of a mechanism for completely specifying
  everything to do with a single error in one data structure,

- the conversion of typecheck_errors.m from using io.write_string to
  using this new capability,

- the conversion of mode_errors.m and det_report.m from using
  write_error_pieces to using this new capability, and

- consistently using the quoting style `symname'/N instead of `symname/N'
  in error_util and hlds_error_util (previously, error_util used the former
  but hlds_error_util used the latter).

This diff sets up later diffs which will collect all error specifications
in a central place and print them all at once, in order.

compiler/error_util.m:
	The new type error_spec, which completely specifies an error.
	An error_spec may have multiple components with different contexts
	and may have parts which are printed only under certain conditions,
	e.g. a given option being set. Each error_spec has a severity
	and also records which phase found the error.

	The new predicate write_error_spec takes care of updates of the exit
	status for errors and (if --halt-at-warn is set) for warnings. It also
	takes care of setting the flag that calls for the reminder about -E
	at the end.

	This diff also makes it simpler to use the ability to print arbitrary
	output. It adds the ability to include integers in messages directly,
	and the ability to create blank lines. It renames some function symbols
	to avoid ambiguities.

	Move a predicate that only used by typecheck_errors.m to that file.

compiler/hlds_error_util.m:
	Switch to the `symname'/N quoting style for describing predicates and
	procedures.

compiler/prog_util.m:
	Switch to the `symname'/N quoting style for describing
	sym_name_and_arity.

compiler/hlds_module.m:
	Provide a predicate to increment the number of errors not by one,
	but by the number of errors printed by write_error_spec.

	Fix some documentation rot.

compiler/typecheck_errors.m:
	Use write_error_spec instead of io.write_strings to print error
	messages. In several cases, improve the formatting of the messages
	printed.

	Mark a number of places where we don't (yet) update the number of
	errors in the module_info correctly.

	Rename the checkpoint predicate to avoid potential ambiguity with
	similar predicates in e.g. mode_info.

compiler/typecheck_info.m:
	Group the code for writing stuff out together in one bunch. For each
	such predicate, create another that returns a list of format components
	instead of doing I/O directly.

compiler/typecheck.m:
	Move the code for writing inference messages here from
	typecheck_errors.m, since these messages aren't errors.

compiler/mode_errors.m:
compiler/det_report.m:
	Use write_error_spec instead of write_error_pieces. In the case of
	mode_errors.m, this means we now get correct the set of circumstances
	in which we set the flag that calls for the reminder about -E.

compiler/add_pragma.m:
compiler/add_type.m:
	Convert some code that used to use write_error_pieces to print error
	messages to use write_error_spec instead.

compiler/assertion.m:
compiler/hlds_pred.m:
compiler/post_typecheck.m:
	Assertion.m used to contain some code to check for assertions in the
	interface that mention predicates that are not exported. Move most
	of this code to post_typecheck.m (which is where this code used to be
	called from). One small part, which is a test for a particular property
	of import_statuses, is moved to hlds_pred.m to be with all the other
	similar tests of import_statuses.

compiler/prog_util.m:
	Change unqualify_name from a predicate to a function.

compiler/pred_table.m:
compiler/hlds_out.m:
	Avoid some ambiguities by adding a suffix to the names of some
	predicates.

compiler/*.m:
	Conform to the changes above.

library/list.m:
	Add a function that was previously present (with different names)
	in two compiler modules.

tests/hard_coded/allow_stubs.exp:
	Update the format of the expected exception.

tests/invalid/errors2.err_exp2:
	Remove this file. As far as I can tell, it was never the correct
	expected output on the main branch. (It originated on the alias branch
	way back in the mists of time.)

tests/invalid/*.err_exp:
tests/invalid/purity/*.err_exp:
tests/warnings/*.exp:
	Update the format of the expected error messages.

tests/recompilation/*.err_exp.2:
	Update the format of the expected messages about what was modified.
2006-09-07 05:51:48 +00:00
Julien Fischer
86e6e38bb3 Don't run this test case with --verbose-error-messages because the
tests/invalid/Mercury.options:
tests/invalid/overloading.err_exp:
	Don't run this test case with --verbose-error-messages because the
	verbose part of the error message varies too much depending on
	which optimizations are enabled.
2006-06-15 04:32:05 +00:00
Julien Fischer
835d8315ef Do not allow discriminated unions with a single zero-arity constructor to have
Estimated hours taken: 10
Branches: main, release

Do not allow discriminated unions with a single zero-arity constructor to have
user-defined equality or comparison.  Defining such types causes an assertion
failure in the compiler because the types are considered to be dummy types and
the runtime currently doesn't support (and probably won't ever) d.u. dummy
types with user-defined equality or comparison.

Fix another bug where the compiler was not printing out the `recompile with
-E' prompt at the appropriate time.  The bug was caused by the fact that there
were several copies of the globals structure and the one that was being
checked at the time the prompt was being printed out was not the one that had
been updated during the rest of compilation.

compiler/add_types.m:
	Emit an error message if an attempt is made to define a d.u.  dummy
	type with user-defined equality or comparison.

compiler/globals.m:
	Remove the extra_error_info field from the globals structure and turn
	it into a mutable.  Export access predicates for this mutable.  The
	reason for doing this is that the compiler was sometimes looking at
	the wrong copy of the globals structure when checking the value of
	this flag - this meant that sometimes the recompile with `-E' prompt
	was not being displayed.  Turning this flag into a mutable avoids the
	problem because now there is only one copy.

compiler/make_hlds.m:
	s/__/./  in a few spots.

doc/reference_manual.texi:
	Mention the new restrictions on discriminated union types with
	user-defined equality or comparison.

tests/invalid/exported_unify2.m:
tests/invalid/exported_unify3.m:
	Change some types with user-defined equality or comparison so that
	they are no longer dummy types.  These test cases have not been
	triggering the assertion failure in the compiler because they are only
	error checked and the assertion that is failing occurs further along
	in the compilation process.

tests/invalid/user_eq_dummy.{m,err_exp}:
	Test the new error message for dummy types with user-defined equality
	or comparison.

tests/invalid/extra_info_prompt.{m,err_exp}:
	Test that the recompile with `-E' prompt is being displayed when it
	should.

tests/invalid/Mercury.options:
tests/invalid/Mmakefile:
	Include the new test cases.

	Where there is a verbose version of the error message compile with
	`-E'.

tests/recompilation/add_type_re.err_exp.2:
tests/invalid/*.err_exp:
	Update expected outputs to conform to the above.
2006-06-14 08:15:01 +00:00
Julien Fischer
e069d16ab1 Do not display the For more information try recompiling with -E'' prompt
Estimated hours taken: 1.5
Branches: main

Do not display the `For more information try recompiling with `-E'' prompt
unless we really mean it, i.e. there is actually more information available.

XXX This change is incomplete for the mode_errors module because that
module requires more substantial changes to make this work - I'll do
that as a separate diff.

compiler/globals.m
	Add a new global (and access predicates) that keeps track of whether
	we have any verbose error information that could be displayed if we
	recompiled with `-E'.

compiler/mercury_compile.m
	Check the new global flag before prompting the user to recompile with
	`-E'.

compiler/mode_errors.m
	Add an XXX comment about needing to respect the extra error info flag
	properly.

compiler/accumulator.m
compiler/add_clause.m
compiler/add_pred.m
compiler/add_type.m
compiler/assertion.m
compiler/check_typeclass.m
compiler/det_report.m
compiler/magic_util.m
compiler/make_hlds_error.m
compiler/modes.m
compiler/module_qual.m
compiler/modules.m
compiler/post_typecheck.m
compiler/purity.m
compiler/stratify.m
compiler/typecheck_errors.m
	Set the new global flag when we come across an error
	for which we have a verbose error message.

tests/recompilation/*:
tests/invalid/*:
	Update expected error files.
2005-09-14 05:27:11 +00:00
Ralph Becket
17300b3e47 Change the compiler output to use "Var: Type" rather than "Var :: Type".
Estimated hours taken: 2
Branches: main

Change the compiler output to use "Var: Type" rather than "Var :: Type".
Eventually we want to use `:' for type annotation and `::' for mode/inst
annotation.

compiler/hlds_out.m:
compiler/post_typecheck.m:
compiler/typecheck.m:
	Change message output to use ": " rather than " :: " when
	associating terms with types.

tests/invalid/ext_type.err_exp:
tests/invalid/overloading.err_exp:
tests/invalid/typeclass_test_8.err_exp:
tests/warnings/singleton_test.exp:
	Change expected compiler output accordingly.
2003-03-28 06:55:15 +00:00
Ralph Becket
a8ffd3680c Change the compiler and tools so that .' and not :' is now used as the
Estimated hours taken: 14
Branches: main

Change the compiler and tools so that `.' and not `:' is now used as the
module separator in all output.

Infix `.' now has associativity yfx and priority 10.

NEWS:
	Report the change.

configure.in:
	Amend the test for an up-to-date Mercury compiler to check whether
	it recognises `.' as a module qualifier.

compiler/code_gen.m:
compiler/error_util.m:
compiler/hlds_out.m:
compiler/prog_out.m:
compiler/prog_util.m:
compiler/rl_exprn.m:
compiler/rl_gen.m:
compiler/source_file_map.m:
compiler/unused_args.m:
library/io.m:
library/rtti_implementation.m:
library/type_desc.m:
runtime/mercury_debug.c:
runtime/mercury_deconstruct.c:
runtime/mercury_stack_trace.c:
	Change `:' to `.' as module separator for output.

compiler/mercury_to_mercury.m:
compiler/prog_io_typeclass.m:
	As above.
	Fixed a bug where `.' was not being recognised as a module separator.

doc/reference_manual.texi:
	Report the change.

library/term_io.m:
	Ensure that infix `.' is written without surrounding spaces.

tests/hard_coded/dot_separator.m:
tests/hard_coded/dot_separator.exp:
tests/hard_coded/Mmakefile:
	Test case added.
2003-01-17 05:57:20 +00:00
Ralph Becket
afffc4bdac Mostly minor fixes to make test cases pass after the state variable
Estimated hours taken: 6
Branches: main

Mostly minor fixes to make test cases pass after the state variable
transformation was introduced.

compiler/make_hlds.m:
	Reversed previous changes that accidentally undid prior work.
	Added state variable transformation to previously missed aditi cases.

tests/invalid/Mmakefile:
	Removed entry for state_vars_test5.m

tests/invalid/state_vars_test3.m:
tests/invalid/state_vars_test3.err_exp:
	Moved this test to tests/warning as state_vars_test.

tests/invalid/state_vars_test4.m:
tests/invalid/state_vars_test4.err_exp:
tests/invalid/state_vars_test5.m:
tests/invalid/state_vars_test5.err_exp:
	Renamed 4->3 and 5->4.

tests/invalid/aditi_update_errors.err_exp:
	The state variable transformation considers conjuncts in reverse
	order w.r.t. before, changing the expected order of these error
	messages.

tests/invalid/overloading.err_exp:
tests/invalid/record_syntax_errors.err_exp:
	Some variable numbers changed after introduction of the state
	variable transformation.

tests/warnings/Mmakefile:
tests/warnings/state_vars_test.m:
tests/warnings/state_vars_test.exp:
	This was tests/invalid/state_vars_test3.{m,exp}.
2002-08-01 00:41:40 +00:00
Zoltan Somogyi
f4b091cb5b When printing messages about errors involving overloaded types, print each
Estimated hours taken: 14
Branches: main

When printing messages about errors involving overloaded types, print each
type only once.

compiler/typecheck.m:
	Detect and eliminate duplicate type names in error messages about
	overloaded types.

	When a variable has more than one type, print each type on a line of
	its own, to make the output easier to read. (Since type names currently
	have too many parentheses, further improvements are still possible.)

compiler/mercury_to_mercury.m:
	Provide a mechanism to turn a type into a string without printing it,
	so that it can be checked againt the representations of other types.

	This required changing many of the predicates in this module so that
	instead of doing I/O directly, they go through a typeclass interface
	which has two implementations: one does I/O while the other gathers
	output in a string.

	The performance impact of this change should be acceptable, since I/O
	is slow compared to computation anyway.

compiler/purity.m:
	Provide a predicate that returns a purity prefix as a string, to
	accompany another that prints it out.

compiler/check_typeclass.m:
compiler/prog_util.m:
	Minor changes to conform to the naming scheme now used in
	mercury_to_mercury.m, in particular to the fact the operations of the
	form x_to_string are now functions, not predicates.

	The functionality of prog_util should be unaffected. In check_typeclass
	we may now print more detailed error messages than before.

library/string.m:
	Declare the outputs append, append_list and join_list to be unique.
	Their implementations already return unique strings; declaring them to
	be unique help avoid redundant copying in mercury_to_mercury.m.

library/term_io.m:
	Add alternative versions of some output predicates that return their
	"output" in a string instead.

	Factor out some common code.

tests/invalid/overloading.{m,exp}:
	A test exercising the error message affected by the change.

tests/invalid/Mmakefile:
	Enable the new test.

NEWS:
	Announce the changes in the library.
2001-08-10 08:29:38 +00:00