mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 10:53:40 +00:00
This means that we can do the exact same checks (and, if needed, generate
the exact same error messages) when generating interface files as when
generating target language code.
This should also allow us to simplify the process of adding type, inst
and mode definitions to the HLDS.
compiler/prog_item.m:
As above.
Delete unused function.
compiler/error_util.m:
Add mechanisms that allow us to distinguish (a) error specs that represent
a type, inst or mode name definition being invalid, from (b) other error
specs.
compiler/check_type_inst_mode_defns.m:
Improve the error messages we generate, in several ways.
First, for each message, specify a real severity. When the messages
could be seen only when generating interface files, making them all
warnings was fine and preserved old behavior, but since soon these
will be the only place for these checks, we need to call errors errors.
Second, specify, in the phase, which errors represent a invalid type,
inst or mode definition, and which don't.
Third, improve the wording of messages. In some places, do this by
being clearer about the distinction between declarations and definitions.
In others, do it by including more information in the message. In yet
others, do it by recovering some kinds of mistakes (mostly items being
in the wrong section) enough to avoid avalanche errors.
Fourth, fix a bug. If a type ctor has an exported *declaration*,
then it is ok for any foreign type definitions for that type_ctor
being in the implementation section, but if the type_ctor has an
exported Mercury *definition*, then any foreign_type definitions
must be in the interface section as well. The code that handled
both these situations did not enforce that.
Fifth, fix another bug: do not include foreign type definitions
in the source definitions of a type_ctor twice, once as a "du" (sic)
definition, and once as itself.
compiler/convert_parse_tree.m:
Check type, inst and mode definitions in raw_compilation_units
when creating parse_tree_module_srcs.
compiler/comp_unit_interface.m:
Make the code constructing interface files work from the checked maps
in parse_tree_module_srcs.
compiler/make_hlds_passes.m:
Set the flags that say we have found invalid type, inst or mode definitions
from the error specs constructed during the creation of the checked
type, inst and mode maps.
compiler/add_type.m:
Comment out an error message for a condition that will be detected and
reported by check_type_inst_mode_defns.m.
compiler/make_hlds_separate_items.m:
For now, turn checked maps of type, inst and mode definitions
back to item lists for addition to the HLDS. Adding whole checked
definitions to the HLDS will be done by a future change.
compiler/make_hlds_error.m:
Fix misleading indentation in an error message.
compiler/parse_tree_out.m:
Conform to the changes above.
Generate output whose indentation does not depend on tab settings.
compiler/check_raw_comp_unit.m:
compiler/equiv_type.m:
compiler/get_dependencies.m:
compiler/grab_modules.m:
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.qualify_items.m:
Conform to the changes above.
compiler/parse_type_defn.m:
Fix misleading error message for ":- type <name> = <type>".
tests/debugger/foreign_type.{m,exp}:
Delete a redundant type declaration to avoid a warning, and update
the .exp file to expect the new line numbers.
tests/invalid/any_mode.err_exp:
tests/invalid/bug436.err_exp:
tests/invalid/bug476.err_exp:
tests/invalid/exported_foreign_enum.err_exp:
tests/invalid/fe_unmapped_nonverbose.err_exp:
tests/invalid/fe_unmapped_verbose.err_exp:
tests/invalid/foreign_enum_invalid.err_exp:
tests/invalid/foreign_solver_type.err_exp:
tests/invalid/foreign_type_visibility.err_exp:
tests/invalid/pragma_qual_error.err_exp:
tests/invalid/repeated_field_name.err_exp:
tests/invalid/subtype_foreign.err_exp:
tests/invalid/type_with_no_defn.err_exp:
tests/invalid/types2.err_exp:
tests/invalid/user_field_access_decl_conflict.err_exp:
tests/invalid_nodepend/bad_foreign_type.err_exp:
tests/invalid_nodepend/bigtest.err_exp:
tests/invalid_nodepend/invalid_typeclass.err_exp:
tests/invalid_nodepend/types.err_exp:
tests/invalid_nodepend/uu_type.err_exp:
tests/invalid_nodepend/where_abstract_enum.err_exp:
Expect the new error messages.
tests/invalid/abstract_solver_type.{m,err_exp}:
tests/warnings/abstract_solver_type.{m,exp}:
Move the abstract_solver_type test case from invalid to warnings, because
this diff changes its only error to be only a warning.
tests/invalid/Mmakefile
13 lines
855 B
Plaintext
13 lines
855 B
Plaintext
repeated_field_name.m:011: Error: duplicate occurrence of the field name `f2'
|
|
repeated_field_name.m:011: in the function symbol `t1'.
|
|
repeated_field_name.m:010: The first occurrence of this field name is here.
|
|
repeated_field_name.m:012: Error: duplicate occurrence of the field name `f2'
|
|
repeated_field_name.m:012: in the function symbol `t1'.
|
|
repeated_field_name.m:010: The first occurrence of this field name is here.
|
|
repeated_field_name.m:015: Error: duplicate occurrence of the field name `f1'
|
|
repeated_field_name.m:015: in the definition of `t'/0.
|
|
repeated_field_name.m:009: The first occurrence of this field name is here.
|
|
repeated_field_name.m:021: Error: duplicate occurrence of the field name `f1'
|
|
repeated_field_name.m:021: in the function symbol `u1'.
|
|
repeated_field_name.m:020: The first occurrence of this field name is here.
|