mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-19 03:13:40 +00:00
We have never supported abstract insts, and we are not likely to start
using them any time soon, but we have had them in the representation of insts
since the beginning. Since they were never actually generated, the code
that operated on them was never really tested, which is good, because
in many places, that code simply threw an exception. The code that didn't
throw an exception when it found an abstract inst had to work correctly
for the abstract_insts that we actually generated, which were abstract
only in the sense that they were references to a would-be user-defined inst
name that wasn't actually defined.
There were two sources of such "abstract" insts.
- One was failed calls to inst_lookup that specified an user_inst inst_name.
- The other consisted of predicates whose job was to construct error messages
involving insts. These either converted cons_ids into abstract insts,
or mangled valid user_inst inst_names into invalid user_inst inst_names,
because error_msg_inst.m generated good-looking messages when given
the results of such conversions.
The first is handled by the fact that module qualification detects and
reports references to undefined insts and modes, and does not let the
compiler proceed to the compiler phases that may call inst_lookup.
The second is handled by the changes to error_msg_inst.m below.
These change to handle the use cases of the two error-message-constructing
predicates that used to employ abstract_insts, but now employ user_inst
defined_insts with a two particular kinds of undefined inst ctor,
one for each use case.
compiler/prog_data.m:
Delete the abstract_int function symbol from the mer_inst type.
compiler/inst_lookup.m:
When the lookup of an user_inst inst_name inside a defined_inst
fails, don't convert that defined_inst into abstract inst,
throw an exception.
compiler/error_msg_inst.m:
Add code to deal with the insts that add_mutable_aux_preds.m and
mode_errors.m generate for us to convert to lists of error message pieces.
The addition is done twice, in an as identical a fashion as possible,
when generating non-inline pieces and when generating inline pieces.
compiler/add_mutable_aux_preds.m:
compiler/mode_errors.m:
Document how these modules cooperates with error_msg_inst.m.
compiler/add_mode.m:
compiler/comp_unit_interface.m:
compiler/direct_arg_in_out.m:
compiler/equiv_type_hlds.m:
compiler/float_regs.m:
compiler/hlds_code_util.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_mode.m:
compiler/hlds_statistics.m:
compiler/inst_abstract_unify.m:
compiler/inst_check.m:
compiler/inst_match.m:
compiler/inst_merge.m:
compiler/inst_mode_type_prop.m:
compiler/inst_test.m:
compiler/inst_user.m:
compiler/inst_util.m:
compiler/make_hlds_passes.m:
compiler/mode_top_functor.m:
compiler/modecheck_coerce.m:
compiler/modecheck_util.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out_inst.m:
compiler/parse_tree_to_term.m:
compiler/pd_util.m:
compiler/prog_mode.m:
compiler/recompilation.usage.m:
compiler/types_into_modes.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the changes above, mostly by deleting code dealing with
abstract_insts.
tests/invalid/functor_ho_inst_bad.err_exp:
tests/invalid/functor_ho_inst_bad_3.err_exp:
tests/invalid/partial_implied_mode.err_exp:
tests/invalid_nodepend/occurs.err_exp:
Update these expected outputs, which each involve errors generated
by the modified code in mode_errors.m or add_mutable_aux_preds.m.
Some of these referred to some things as "named insts" when they were
*not* named insts in the program.
tests/invalid_nodepend/kind.{m,err_exp}:
Add some invalid code to this test, and update the expected output
accordingly.
31 lines
1.7 KiB
Plaintext
31 lines
1.7 KiB
Plaintext
partial_implied_mode.m:038: In clause for
|
|
partial_implied_mode.m:038: `'__Unify__'((unique(partial_implied_mode_helper_1.physic_quantity(ground,
|
|
partial_implied_mode.m:038: free,
|
|
partial_implied_mode.m:038: unique(partial_implied_mode_helper_1.absol(free,
|
|
partial_implied_mode.m:038: free)))) >>
|
|
partial_implied_mode.m:038: bound(partial_implied_mode_helper_1.physic_quantity(ground,
|
|
partial_implied_mode.m:038: ground,
|
|
partial_implied_mode.m:038: bound(partial_implied_mode_helper_1.absol(ground,
|
|
partial_implied_mode.m:038: ground))))), (ground >>
|
|
partial_implied_mode.m:038: bound(partial_implied_mode_helper_1.physic_quantity(ground,
|
|
partial_implied_mode.m:038: ground,
|
|
partial_implied_mode.m:038: bound(partial_implied_mode_helper_1.absol(ground,
|
|
partial_implied_mode.m:038: ground))))))':
|
|
partial_implied_mode.m:038: mode error in unification of `HeadVar__1' and
|
|
partial_implied_mode.m:038: `partial_implied_mode_helper_1.physic_quantity(V_13,
|
|
partial_implied_mode.m:038: ArgX2, V_14)'.
|
|
partial_implied_mode.m:038: Variable `HeadVar__1' has instantiatedness
|
|
partial_implied_mode.m:038: unique(
|
|
partial_implied_mode.m:038: physic_quantity(
|
|
partial_implied_mode.m:038: ground,
|
|
partial_implied_mode.m:038: free,
|
|
partial_implied_mode.m:038: unique(
|
|
partial_implied_mode.m:038: absol(free, free)
|
|
partial_implied_mode.m:038: )
|
|
partial_implied_mode.m:038: )
|
|
partial_implied_mode.m:038: ),
|
|
partial_implied_mode.m:038: term
|
|
partial_implied_mode.m:038: `partial_implied_mode_helper_1.physic_quantity(V_13,
|
|
partial_implied_mode.m:038: ArgX2, V_14)' has instantiatedness
|
|
partial_implied_mode.m:038: partial_implied_mode_helper_1.physic_quantity(free, ground, free).
|