mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-22 21:03:53 +00:00
Estimated hours taken: 10 Fix a code generator abort reported by Stephane Marie <stephane.marie@detexis.thomson-csf.com>. The bug was in the code to work out the instmap after a deconstruction unification with complicated sub-unifications. The instmap_delta for the unification contained only the bindings for the first argument for which a new variable was created. The test case now gives an error during mode analysis rather than a code generator abort (for unification procedures of imported types) or a mode error during unique mode analysis (for local types). compiler/modes.m: compiler/modecheck_call.m: compiler/modecheck_unify.m: Simplify the code to handle extra goals by not attempting to bodge together the instmap after the main goal. Instead, the code now creates the extra unifications and rechecks the goal with the unifications added. compiler/mode_info.m: Add a field to say whether we are reprocessing a goal after adding extra goals. Abort if the reprocessing adds more extra goals. The `may_changed_called_proc' field is now separate from the `how_to_check_goal' field. This is used to avoid repeating the search for the best procedure when rerunning mode analysis after adding the extra goals. compiler/modecheck_unify.m: Removed predicate unify_vars - it is no longer used. compiler/unify_proc.m: Call module_info_remove_predid if there are mode errors in a unification procedure to avoid spurious determinism errors. tests/hard_coded/Mmakefile: tests/hard_coded/partial_implied_mode.m: tests/hard_coded/partial_implied_mode.err_exp: Test case. It would be nicer if the error message pointed to the unification which caused the unification procedure to be created, rather than the type declaration in the interface file.
40 lines
878 B
Mathematica
40 lines
878 B
Mathematica
% Type definitions for partial_implied_mode.m.
|
|
:- module partial_implied_mode2.
|
|
|
|
:- interface.
|
|
|
|
:- import_module std_util, list.
|
|
|
|
:- type pin.
|
|
:- type quantity_key.
|
|
:- type measure == int.
|
|
:- type tbs == int.
|
|
|
|
:- type physic_quantity
|
|
---> physic_quantity(pin, list(quantity_key), physic_nature).
|
|
:- type physic_nature
|
|
---> direct
|
|
; absol(maybe(measure), maybe(tbs))
|
|
; diff(pin, maybe(pair(quantity_key, quantity_key)),
|
|
maybe(measure), maybe(tbs)).
|
|
|
|
:- type port_name_ref == int.
|
|
:- type master_port
|
|
---> port_name_ref(port_name_ref)
|
|
; anonymous_master_port(int).
|
|
|
|
:- type instance_path == list(int).
|
|
:- type component_key
|
|
---> component(instance_path).
|
|
|
|
:- type net_path == list(int).
|
|
:- type net_key
|
|
---> anonymous_net(int)
|
|
; named_net(net_path).
|
|
|
|
:- type pin
|
|
---> net_pin(net_key)
|
|
; component_pin(component_key, master_port).
|
|
|
|
:- type quantity_key == int.
|